<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-99.9.9">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

<meta name="author" content="J Andrés Gannon">
<meta name="author" content="Kerry Chavez">
<meta name="author" content="Cole Reynolds">
<meta name="author" content="Thomas Brailey">
<meta name="dcterms.date" content="2023-04-11">

<title>01 Data Prep - Existing Intervention Datasets</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
  { counter-reset: source-line 0; }
pre.numberSource code > span
  { position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
  { content: counter(source-line);
    position: relative; left: -1em; text-align: right; vertical-align: baseline;
    border: none; display: inline-block;
    -webkit-touch-callout: none; -webkit-user-select: none;
    -khtml-user-select: none; -moz-user-select: none;
    -ms-user-select: none; user-select: none;
    padding: 0 4px; width: 4em;
    color: #aaaaaa;
  }
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa;  padding-left: 4px; }
div.sourceCode
  {   }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
div.csl-bib-body { }
div.csl-entry {
  clear: both;
}
.hanging div.csl-entry {
  margin-left:2em;
  text-indent:-2em;
}
div.csl-left-margin {
  min-width:2em;
  float:left;
}
div.csl-right-inline {
  margin-left:2em;
  padding-left:1em;
}
div.csl-indent {
  margin-left: 2em;
}
</style>


<script src="01_DataPrep_ExistingData_files/libs/clipboard/clipboard.min.js"></script>
<script src="01_DataPrep_ExistingData_files/libs/quarto-html/quarto.js"></script>
<script src="01_DataPrep_ExistingData_files/libs/quarto-html/popper.min.js"></script>
<script src="01_DataPrep_ExistingData_files/libs/quarto-html/tippy.umd.min.js"></script>
<script src="01_DataPrep_ExistingData_files/libs/quarto-html/anchor.min.js"></script>
<link href="01_DataPrep_ExistingData_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="01_DataPrep_ExistingData_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="01_DataPrep_ExistingData_files/libs/bootstrap/bootstrap.min.js"></script>
<link href="01_DataPrep_ExistingData_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="01_DataPrep_ExistingData_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet">

<script src="01_DataPrep_ExistingData_files/libs/htmlwidgets-1.6.2/htmlwidgets.js"></script>
<link href="01_DataPrep_ExistingData_files/libs/datatables-css-0.0.0/datatables-crosstalk.css" rel="stylesheet">
<script src="01_DataPrep_ExistingData_files/libs/datatables-binding-0.27/datatables.js"></script>
<script src="01_DataPrep_ExistingData_files/libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<link href="01_DataPrep_ExistingData_files/libs/dt-core-1.12.1/css/jquery.dataTables.min.css" rel="stylesheet">
<link href="01_DataPrep_ExistingData_files/libs/dt-core-1.12.1/css/jquery.dataTables.extra.css" rel="stylesheet">
<script src="01_DataPrep_ExistingData_files/libs/dt-core-1.12.1/js/jquery.dataTables.min.js"></script>
<link href="01_DataPrep_ExistingData_files/libs/crosstalk-1.2.0/css/crosstalk.min.css" rel="stylesheet">
<script src="01_DataPrep_ExistingData_files/libs/crosstalk-1.2.0/js/crosstalk.min.js"></script>


<link rel="stylesheet" href="styles.css">
</head>

<body>

<header id="title-block-header" class="quarto-title-block default page-columns page-full">
  <div class="quarto-title-banner page-columns page-full">
    <div class="quarto-title column-body">
      <div class="quarto-title-block"><div><h1 class="title">01 Data Prep - Existing Intervention Datasets</h1><button type="button" class="btn code-tools-button dropdown-toggle" id="quarto-code-tools-menu" data-bs-toggle="dropdown" aria-expanded="false"><i class="bi"></i> Code</button><ul class="dropdown-menu dropdown-menu-end" aria-labelelledby="quarto-code-tools-menu"><li><a id="quarto-show-all-code" class="dropdown-item" href="javascript:void(0)" role="button">Show All Code</a></li><li><a id="quarto-hide-all-code" class="dropdown-item" href="javascript:void(0)" role="button">Hide All Code</a></li><li><hr class="dropdown-divider"></li><li><a id="quarto-view-source" class="dropdown-item" href="javascript:void(0)" role="button">View Source</a></li></ul></div></div>
                      </div>
  </div>
    
  
  <div class="quarto-title-meta">

      <div>
      <div class="quarto-title-meta-heading">Authors</div>
      <div class="quarto-title-meta-contents">
               <p>J Andrés Gannon </p>
               <p>Kerry Chavez </p>
               <p>Cole Reynolds </p>
               <p>Thomas Brailey </p>
            </div>
    </div>
      
      <div>
      <div class="quarto-title-meta-heading">Published</div>
      <div class="quarto-title-meta-contents">
        <p class="date">April 11, 2023</p>
      </div>
    </div>
      
    </div>
    
  
  </header><div id="quarto-content" class="page-columns page-rows-contents page-layout-article">
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
  <nav id="TOC" role="doc-toc">
    <h2 id="toc-title">Table of contents</h2>
   
  <ul>
  <li><a href="#existing-datasets" id="toc-existing-datasets" class="nav-link active" data-scroll-target="#existing-datasets">Existing datasets</a>
  <ul class="collapse">
  <li><a href="#icb" id="toc-icb" class="nav-link" data-scroll-target="#icb">ICB</a></li>
  <li><a href="#imi" id="toc-imi" class="nav-link" data-scroll-target="#imi">IMI</a></li>
  <li><a href="#mids" id="toc-mids" class="nav-link" data-scroll-target="#mids">MIDs</a></li>
  <li><a href="#mip" id="toc-mip" class="nav-link" data-scroll-target="#mip">MIP</a></li>
  <li><a href="#mips" id="toc-mips" class="nav-link" data-scroll-target="#mips">MIPS</a></li>
  <li><a href="#prio" id="toc-prio" class="nav-link" data-scroll-target="#prio">PRIO</a></li>
  <li><a href="#rand" id="toc-rand" class="nav-link" data-scroll-target="#rand">RAND</a></li>
  <li><a href="#aerial-bombing" id="toc-aerial-bombing" class="nav-link" data-scroll-target="#aerial-bombing">Aerial bombing</a></li>
  </ul></li>
  <li><a href="#merge" id="toc-merge" class="nav-link" data-scroll-target="#merge">Merge</a></li>
  <li><a href="#match-to-wiki" id="toc-match-to-wiki" class="nav-link" data-scroll-target="#match-to-wiki">Match to Wiki</a></li>
  <li><a href="#compare-existing-datasets-to-wiki" id="toc-compare-existing-datasets-to-wiki" class="nav-link" data-scroll-target="#compare-existing-datasets-to-wiki">Compare Existing Datasets to Wiki</a></li>
  </ul>
</nav>
</div>
<main class="content quarto-banner-title-block" id="quarto-document-content">




<div class="cell">

</div>
<p>Our universe of cases is US military interventions after the Cold War.</p>
<section id="existing-datasets" class="level1">
<h1>Existing datasets</h1>
<p>We start by identifying list of US interventions coded in existing IR datasets as well as their temporal scope. We can then compare their coverage to see what covariates may conflict and where things may be missing.</p>
<p>The first step will be loading each dataset and subsetting it to the appropriate actor (US as intervenor) and time period (post-Cold War).</p>
<section id="icb" class="level2">
<h2 class="anchored" data-anchor-id="icb">ICB</h2>
<p>The International Crisis Behavior (ICB) datasets concerns international crises that may or may not have escalated to war <span class="citation" data-cites="brecher_studycrisis_1997">(<a href="#ref-brecher_studycrisis_1997" role="doc-biblioref">Brecher and Wilkenfeld 1997</a>)</span>. We filter the dataset so that it only includes the crisis in which the United States was an actor in the post-Cold War period.</p>
<div class="cell" data-hash="01_DataPrep_ExistingData_cache/html/unnamed-chunk-1_bf32bd7bb77c0c9d386f6f509d5d88e1">
<details>
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>icb <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(),<span class="st">"/inst/extdata/icb2v12.csv"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(yrtrig <span class="sc">&gt;=</span> <span class="dv">1989</span> <span class="sc">&amp;</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a>                  actor <span class="sc">==</span> <span class="st">"USA"</span>)</span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(icb)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">

<div class="datatables html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-003fdce43cb0d5b79f33" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-003fdce43cb0d5b79f33">{"x":{"filter":"none","vertical":false,"data":[["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"],["ICB2","ICB2","ICB2","ICB2","ICB2","ICB2","ICB2","ICB2","ICB2","ICB2","ICB2","ICB2","ICB2","ICB2","ICB2","ICB2","ICB2","ICB2","ICB2","ICB2"],[391,393,408,411,412,419,422,427,429,430,434,440,441,448,450,459,464,469,470,476],[841,846,885,890,894,908,913,929,933,945,955,968,969,987,990,1007,1019,1032,1035,1052],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],["USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA"],[1989,1990,1993,1994,1994,1996,1997,1998,1998,1999,2001,2002,2002,2006,2006,2009,2011,2013,2013,2015],[12,8,3,7,10,8,11,8,10,2,9,9,10,1,5,3,2,2,8,11],[15,2,66,77,7,31,13,7,31,20,11,12,4,10,5,11,22,12,21,24],["INVASION OF PANAMA","GULF WAR","N. KOREA NUCLEAR I","HAITI MIL. REGIME","IRAQ DEPLOY./KUWAIT","DESERT STRIKE","UNSCOM I","US EMBASSY BOMBINGS","UNSCOM II","KOSOVO","AFGHANISTAN/US","IRAQ REGIME CHANGE","N. KOREA NUCLEAR II","IRAN NUCLEAR II","N. KOREA NUCLEAR III","N. KOREA NUCLEAR IV-SATELLITE LAUNCH","LIBYAN CIVILWAR","N. KOREA NUCLEAR V","SYRIA CHEMICAL WEAPONS","TURKEY-RUSSIA JET INCIDENT"],[2,2,2,2,7,8,2,9,2,2,9,2,1,5,4,1,8,7,8,8],[1989,1990,1993,1994,1994,1996,1997,1998,1998,1999,2001,2003,2002,2006,2006,2009,2011,2013,2013,2015],[12,10,3,7,10,8,11,8,10,2,9,1,10,1,5,3,2,2,8,11],[15,30,12,77,7,31,13,7,31,20,11,13,4,10,5,11,22,12,21,24],[95,997,731,996,645,645,645,996,645,345,996,645,731,630,731,731,620,731,652,640],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[95,645,731,41,645,645,645,700,645,345,700,645,731,630,731,731,620,731,652,365],[1,3,1,1,2,2,2,1,2,2,1,2,1,2,1,2,1,2,2,4],[1,2,2,2,2,null,3,null,3,1,3,3,2,2,2,-99,-99,-99,-99,null],[1,1,1,1,1,null,1,1,1,1,1,1,1,1,1,1,1,-99,1,1],[1,1,1,1,1,1,1,1,1,1,1,1,5,4,5,1,1,1,1,1],[8,8,4,6,7,8,6,8,8,8,9,8,4,2,2,7,9,7,7,3],[1989,1991,1993,1994,1994,1996,1997,1998,1998,1999,2001,2003,2002,2006,2006,2009,2011,2013,2013,2015],[12,1,6,9,10,9,11,8,12,3,10,3,10,1,7,3,3,3,8,11],[20,17,14,19,7,3,14,20,16,24,7,20,16,11,15,12,17,7,31,24],[6,80,95,51,1,4,1,13,46,32,26,66,12,2,72,2,24,24,11,1],[8,7,1,1,6,7,6,8,7,7,8,8,1,5,1,4,7,4,4,4],[4,4,1,1,1,4,1,4,4,3,4,4,1,1,1,1,4,1,1,1],[3,4,1,1,1,2,1,2,3,3,3,4,1,1,1,1,3,1,1,1],[9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9],[8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8],[3,3,1,1,3,3,3,1,3,3,7,3,3,3,3,3,3,3,3,7],[3,3,5,5,6,3,3,5,3,3,3,3,1,1,3,2,2,2,2,3],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[5,6,4,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,4,4],[6,14,11,13,6,3,11,6,11,12,7,7,6,11,11,11,13,11,4,7],[4,2,2,2,2,4,2,3,2,2,2,4,4,2,2,2,2,2,2,3],[4,9,1,1,2,1,2,1,1,3,3,2,9,11,1,1,3,1,2,3],[5,13,1,1,6,1,6,1,1,12,3,2,5,13,1,1,12,1,6,13],[3,1,5,5,1,1,3,5,5,1,1,2,1,1,5,5,1,5,2,1],[1,1,2,1,1,1,1,2,2,1,1,1,2,2,2,3,1,3,2,2],[4,8,1,8,6,7,1,4,4,1,8,8,2,4,1,15,13,1,7,2],[2,2,1,2,2,2,1,2,2,2,2,2,1,1,1,3,2,1,2,2],[2,1,1,2,1,1,1,1,1,2,2,2,1,2,1,1,3,3,3,3],[1990,1991,1994,1994,1994,1996,1998,1998,1998,1999,2001,2003,2004,2007,2007,2009,2011,2013,2013,2016],[1,4,10,10,11,9,2,8,12,6,12,5,1,12,10,8,10,8,9,2],[3,12,21,15,10,14,23,20,20,10,7,1,6,4,3,4,20,14,21,77],[20,165,589,77,35,15,102,13,50,109,88,108,459,694,517,147,241,194,32,89],[14,85,495,26,35,11,101,1,4,77,62,42,447,693,446,146,218,161,22,89],[41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41],[42,15,11,42,15,15,15,22,15,35,41,15,11,13,11,11,21,11,15,10],[2,4,4,2,4,4,4,4,4,4,1,4,4,4,4,4,4,4,4,4],[2,34,6,null,14,4,5,5,3,11,5,8,6,8,6,4,19,5,5,9],[161,165,186,187,187,187,187,187,187,190,191,192,192,193,193,194,195,195,195,195],[4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],[1,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],[1,1,2,1,2,2,2,1,2,2,1,2,2,1,2,2,1,2,1,1],[0,0,34,0,25,32,32,0,32,33,0,32,34,0,34,34,0,34,0,0],[3,4,1,2,1,2,1,2,3,3,3,4,1,1,1,1,3,1,1,1],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[19,11,12,19,14,15,15,5,37,179,39,37,13,52,12,null,109,null,11,null],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[6,7,6,6,7,6,6,6,6,7,7,6,6,6,6,6,6,6,6,7],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],[3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3],[4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4],[3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3],[4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4],[4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4],[2,3,2,2,null,2,1,1,1,4,1,1,1,1,1,1,4,1,1,1],[6,1,6,6,null,1,6,6,6,6,6,6,6,6,6,6,2,6,6,6],[4,4,4,4,4,4,2,1,2,4,5,5,4,4,4,4,7,4,4,5],[4,1,5,4,null,7,1,1,1,5,1,1,7,6,7,7,1,7,7,1],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],[2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,1,2,2,3],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,2],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,2,2,3],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],[3,3,4,2,3,3,3,3,3,4,3,3,2,2,2,1,1,3,2,3]],"container":"<table class=\"display\">\n  <thead>\n    <tr>\n      <th> <\/th>\n      <th>icb2<\/th>\n      <th>crisno<\/th>\n      <th>cracno<\/th>\n      <th>cracid<\/th>\n      <th>actor<\/th>\n      <th>systrgyr<\/th>\n      <th>systrgmo<\/th>\n      <th>systrgda<\/th>\n      <th>crisname<\/th>\n      <th>triggr<\/th>\n      <th>yrtrig<\/th>\n      <th>motrig<\/th>\n      <th>datrig<\/th>\n      <th>trigent<\/th>\n      <th>trigloc<\/th>\n      <th>southv<\/th>\n      <th>southpow<\/th>\n      <th>sizedu<\/th>\n      <th>strcdu<\/th>\n      <th>comlev<\/th>\n      <th>majres<\/th>\n      <th>yerres<\/th>\n      <th>monres<\/th>\n      <th>dayres<\/th>\n      <th>trgresra<\/th>\n      <th>crismg<\/th>\n      <th>cenvio<\/th>\n      <th>sevvio<\/th>\n      <th>usinv<\/th>\n      <th>usfavr<\/th>\n      <th>suinv<\/th>\n      <th>sufavr<\/th>\n      <th>gbinv<\/th>\n      <th>gbfavr<\/th>\n      <th>frinv<\/th>\n      <th>frfavr<\/th>\n      <th>itinv<\/th>\n      <th>itfavr<\/th>\n      <th>grinv<\/th>\n      <th>grfavr<\/th>\n      <th>jpinv<\/th>\n      <th>jpfavr<\/th>\n      <th>globorg<\/th>\n      <th>globact<\/th>\n      <th>globfavr<\/th>\n      <th>regorg<\/th>\n      <th>regact<\/th>\n      <th>rofavr<\/th>\n      <th>outcom<\/th>\n      <th>outfor<\/th>\n      <th>outevl<\/th>\n      <th>outesr<\/th>\n      <th>yrterm<\/th>\n      <th>moterm<\/th>\n      <th>daterm<\/th>\n      <th>trgterra<\/th>\n      <th>resterra<\/th>\n      <th>actloc<\/th>\n      <th>geog<\/th>\n      <th>cractloc<\/th>\n      <th>noactr<\/th>\n      <th>stainsys<\/th>\n      <th>period<\/th>\n      <th>syslev<\/th>\n      <th>pc<\/th>\n      <th>pcid<\/th>\n      <th>viol<\/th>\n      <th>iwc<\/th>\n      <th>powdis<\/th>\n      <th>gpinv<\/th>\n      <th>powinv<\/th>\n      <th>age<\/th>\n      <th>territ<\/th>\n      <th>regime<\/th>\n      <th>durreg<\/th>\n      <th>allycap<\/th>\n      <th>globmemb<\/th>\n      <th>nuclear<\/th>\n      <th>powsta<\/th>\n      <th>issue<\/th>\n      <th>chissu<\/th>\n      <th>gravty<\/th>\n      <th>pethin<\/th>\n      <th>col<\/th>\n      <th>unemp<\/th>\n      <th>inflat<\/th>\n      <th>foodpr<\/th>\n      <th>labstr<\/th>\n      <th>short<\/th>\n      <th>econdt<\/th>\n      <th>regrep<\/th>\n      <th>socunr<\/th>\n      <th>massvl<\/th>\n      <th>gvinst<\/th>\n      <th>sourdt<\/th>\n    <\/tr>\n  <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[2,3,4,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95]},{"orderable":false,"targets":0}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
</section>
<section id="imi" class="level2">
<h2 class="anchored" data-anchor-id="imi">IMI</h2>
<p>The IMI dataset includes international military interventions from 1946-2005 <span class="citation" data-cites="pearson_internationalmilitaryintervention_1993">Kisangani and Pickering (<a href="#ref-kisangani_internationalmilitaryintervention_2008" role="doc-biblioref">2008</a>)</span>. It defines interventions as “the movement of regular troops or forces (airborne, seaborne, shelling, etc) of one country inside another, in the context of some political issue or dispute”. We filter the dataset so that it only includes the crisis in which the United States was an actor in the post-Cold War period.</p>
<div class="cell" data-hash="01_DataPrep_ExistingData_cache/html/unnamed-chunk-2_df6dc937751529da354f1b2e9e71a637">
<details>
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>imi <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(),<span class="st">"/inst/extdata/IMI/IMI_dataset.csv"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(start <span class="sc">&gt;=</span> <span class="dv">19890101</span> <span class="sc">&amp;</span></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a>                  intervener <span class="sc">==</span> <span class="dv">2</span>)</span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a>imi<span class="sc">$</span>start <span class="ot">&lt;-</span> <span class="fu">gsub</span>(<span class="st">'.{4}$'</span>, <span class="st">''</span>, imi<span class="sc">$</span>start)</span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(imi)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">

<div class="datatables html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-7f79845b772ae1add865" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-7f79845b772ae1add865">{"x":{"filter":"none","vertical":false,"data":[["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38"],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],[660,840,95,450,670,690,645,451,520,346,490,517,41,690,450,482,690,339,451,484,531,910,710,625,700,450,700,700,437,645,450,41,770,800,850,780,41,770],["1989","1989","1989","1990","1990","1990","1991","1992","1992","1993","1994","1994","1994","1994","1996","1996","1996","1997","1997","1997","1998","1998","1998","1998","1998","1998","2001","2001","2002","2003","2003","2004","2004","2004","2004","2005","2005","2005"],[19890906,19891209,19900228,19910110,19910115,19910406,19910228,19920503,19940325,19960109,19940930,19940930,19950331,19941224,19960618,19960731,19961215,19970314,19970601,19970618,19980609,19980801,19980810,19980820,19980820,19980925,20011208,88888888,20020929,88888888,20030930,20040601,20040420,20050401,20050126,20050215,20050513,20060330],[1,2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[0,1,2,0,1,1,3,0,0,0,0,0,3,1,0,0,1,0,0,0,0,1,1,3,3,0,3,1,0,3,0,3,6,1,1,1,0,1],[1,4,5,3,3,5,5,1,5,2,3,3,4,4,1,1,4,1,1,1,1,2,2,4,4,1,5,3,1,5,4,3,3,2,2,2,3,2],[0,1,4,2,4,4,4,1,4,0,2,2,4,4,1,1,2,1,1,1,1,1,0,0,0,0,4,4,1,4,2,2,9,4,4,2,1,2],[1,3,4,3,3,4,4,1,4,2,2,2,3,3,1,1,3,1,1,1,1,2,2,0,0,1,4,3,1,4,2,2,0,2,2,2,0,2],[0,0,9,4,4,4,9,0,2,0,0,0,4,4,2,0,2,2,1,9,0,0,0,5,5,0,9,9,0,5,4,2,0,2,2,2,2,0],[9,9,9,1,2,2,2,9,9,9,9,9,2,2,1,9,2,1,1,9,9,9,9,1,1,9,9,9,9,2,1,2,9,2,2,9,1,9],[0,0,9,0,0,1,1,0,9,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,0,1,0,0,1,0,0,0,0,0,0,0,0],[0,0,82,9999999,28,9999999,31,0,205,0,0,0,9999999,0,0,0,0,9999999,0,0,0,0,0,0,9999999,0,12,215,0,23385,0,0,0,0,0,0,0,0],[0,9999999,56,9999999,0,9999999,998,0,9999999,0,0,0,9999999,0,0,0,0,9999999,0,0,0,0,0,9999999,9999999,0,9999999,9999999,0,9999999,0,9999999,0,0,0,0,0,0],[0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0],[0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,1,1,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0],[0,1,1,0,1,1,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,1,1,0,1,1,0,1,1,1,0,0,0,0,0,0],[0,0,0,1,0,0,0,0,1,1,1,1,1,0,0,0,0,1,1,0,0,1,1,0,0,0,1,1,0,0,1,0,0,1,1,1,1,1],[0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[1,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0],[0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,1,0,1,0,1,1,1,0,0,0,1],["U.S evacuates diplomats from Lebanon (AP, NYT)","US aids Phillippine government after coup attempt (AP, UPI, Xinh)","US removes Panamanian government (WP, NYT)","US evacuates American citizens from Liberia during civil conflict (CSM, AP, WP)","US in Saudi Arabia to protect it from Iraqi invasion in Op. Desert Shield (US Today, Des. Shield Factbook, Gulf War Chronicle)","US restores Kuwaiti government in Desert Storm (USA Today, Gulf War Chronicle)","US moves troops into Iraq from Saudi Arabia (USA Today, Factbook, Gulf War Chronicle)","U.S.troops evacuate Americans from Sierra Leone (AP, Herald)","U.S. troops give humanitarian relief to Somalia (Xinh, UP, AP) ","US planes drop food in Bosnia-Herzegovina  (TS, Xinh, UP)    ","US troops provide humanitarian assistance in Zaire (Reuters)","US provides humanitarian relief in Rwanda (UPI, WP)","US restores democratically elected government in Haiti  (UPI, AP)","US build up in Kuwait to respond to Iraqi border build-up (UPI, AP)","Operation Assured Response by US to evacuate 2444 people from Liberia (globalsecurity.org)","US evacuates nationals and protects embassy in the Central African Republic (UPI)","US buildup of troops in Kuwait after Iraq's provocation (SDUT, Reuters)","US evacuates American citizens from Albania (GNL)","US evacuates civilians from Sierra Leone (DP, Xinh)","US evacuates diplomats from Congo (BBN, TN)","US evacuates Americans from Eritrea (AP, AFP, UPI)","US gives aid to Papua-New Guinea following tidal wave disaster (FDAD, Canberra)","US Air Force delivers relief to China after devastating flood (M2, Comm)","US carries out air strikes against suspected terrorist facilities in Sudan (TNS, PI)","US uses cruise missiles to attack suspected terrorist facilities (Xinh, IP, DP)","US evacuates opposition militia member from Liberia (NYT)","US forces attack Taliban positions in Afghanistan (Global Security, TASS)","US forces patrol and provide security and act as peacekeeping force in Afghanistan (globalsecurity.org)","US evacuates foreigners in Ivory Coast (AFP, AllAfrica, CW)","US topples Iraqi government (DP, AFX, CNN)","US send peacekeepers to Liberia (Fed. Info, AFP, DP)","US aids in restoring order in Haiti (AP, AFP)","US pursues Taliban insurgents into Pakistan (AFP)","US provides tsunami relief to Thailand (AP, BBC)","US provides tsunami relief to Indonesia (FT, AFP, Scripps)","US provides tsunami relief to Sri Lanka (AFP, AP)","US troops build schools and provide medical aid in Haiti (AP, Navy Newsstand)","US troops give humanitarian aid to Pakistan after earthquake (FT, Reuters)"],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]],"container":"<table class=\"display\">\n  <thead>\n    <tr>\n      <th> <\/th>\n      <th>intervener<\/th>\n      <th>target<\/th>\n      <th>start<\/th>\n      <th>end<\/th>\n      <th>source<\/th>\n      <th>direction<\/th>\n      <th>type<\/th>\n      <th>amount<\/th>\n      <th>air<\/th>\n      <th>naval<\/th>\n      <th>size_naval<\/th>\n      <th>firing_outside<\/th>\n      <th>intervener_casualties<\/th>\n      <th>target.casualties<\/th>\n      <th>domestic_dispute<\/th>\n      <th>affect_policies<\/th>\n      <th>social_protective<\/th>\n      <th>pursuit_border<\/th>\n      <th>economic<\/th>\n      <th>strategic<\/th>\n      <th>humanitarian<\/th>\n      <th>territorial<\/th>\n      <th>military.diplomatic<\/th>\n      <th>contiguity<\/th>\n      <th>int_contig<\/th>\n      <th>description<\/th>\n      <th>X<\/th>\n      <th>X.1<\/th>\n      <th>X.2<\/th>\n      <th>X.3<\/th>\n      <th>X.4<\/th>\n      <th>X.5<\/th>\n      <th>X.6<\/th>\n      <th>X.7<\/th>\n      <th>X.8<\/th>\n      <th>X.9<\/th>\n      <th>X.10<\/th>\n      <th>X.11<\/th>\n      <th>X.12<\/th>\n      <th>X.13<\/th>\n      <th>X.14<\/th>\n      <th>X.15<\/th>\n      <th>X.16<\/th>\n      <th>X.17<\/th>\n      <th>X.18<\/th>\n      <th>X.19<\/th>\n      <th>X.20<\/th>\n      <th>X.21<\/th>\n      <th>X.22<\/th>\n      <th>X.23<\/th>\n      <th>X.24<\/th>\n      <th>X.25<\/th>\n      <th>X.26<\/th>\n      <th>X.27<\/th>\n      <th>X.28<\/th>\n      <th>X.29<\/th>\n    <\/tr>\n  <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]},{"orderable":false,"targets":0}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
</section>
<section id="mids" class="level2">
<h2 class="anchored" data-anchor-id="mids">MIDs</h2>
<p>The MIDs dataset covers all conflicts in which a state threatens, displays, or uses force against another state from 1816-2010 <span class="citation" data-cites="palmer_mid4dataset2002_2015">(<a href="#ref-palmer_mid4dataset2002_2015" role="doc-biblioref">Palmer et al. 2015</a>)</span>. Dispute level dataset is chosen at the participant level to best identify broader disputes where the US was an actor. Disputes are inclusive of their incidents and the participant-level data allows us to subset to the US. Covariates for those disputes can later be merged from the dispute-level dataset. We filter the dataset so that it only includes the interventions in which the United States was an actor in the post-Cold War period.</p>
<div class="cell" data-hash="01_DataPrep_ExistingData_cache/html/unnamed-chunk-3_8645e7ed984a457ea2fff02626952957">
<details>
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>mids <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(),<span class="st">"/inst/extdata/MIDs/MIDs_dispute-participants.csv"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(styear <span class="sc">&gt;=</span> <span class="dv">1989</span> <span class="sc">&amp;</span></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a>                  ccode <span class="sc">==</span> <span class="dv">2</span>)</span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(mids)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">

<div class="datatables html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-118963e58a74696d661b" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-118963e58a74696d661b">{"x":{"filter":"none","vertical":false,"data":[["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69","70","71","72"],[3550,3551,3552,3568,3900,3901,3950,3957,3972,3973,3974,4016,4021,4022,4046,4064,4065,4088,4125,4137,4174,4183,4186,4190,4196,4197,4213,4216,4217,4218,4220,4227,4254,4261,4269,4271,4273,4280,4281,4283,4298,4299,4342,4343,4371,4397,4450,4451,4455,4460,4465,4483,4486,4506,4512,4516,4518,4519,4524,4527,4535,4538,4540,4541,4543,4552,4568,4571,4575,4577,4581,4598],[-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,50202,-9,-9,-9,-9,-9,-9,-9,10407,10802,30208,30209,30304,30309,30401,30901,30904,41001,50302,50306,50401,50402,50407,50501,50701,50704,50801,50802,50902,70202,70503,70506,70604,70701,70801,71001],["USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA"],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],[24,16,27,11,11,12,31,24,29,21,15,18,3,5,23,19,23,-9,16,3,15,25,21,-9,24,26,2,3,20,23,17,20,-9,21,2,30,7,23,25,15,26,26,8,24,6,2,19,10,21,3,30,25,9,8,22,5,-9,14,19,15,11,28,26,5,25,30,8,30,30,22,29,27],[4,7,7,1,12,1,1,7,7,5,3,10,3,11,4,12,8,7,6,5,8,5,2,6,2,11,2,10,8,3,10,8,9,10,8,8,10,3,4,9,9,6,4,11,11,3,9,12,2,7,4,7,3,1,3,7,3,3,8,6,1,8,10,11,2,12,5,11,10,1,1,9],[1992,1992,1992,1993,1989,1989,1990,1990,1991,1991,1991,1993,1993,1993,1994,1995,1994,1999,1999,1998,1997,1997,2000,1996,1996,2000,2000,1997,1998,2000,2000,1998,1998,2000,1994,1996,1997,2001,2001,2001,2000,1993,1999,2000,2004,2008,2002,2002,2003,2003,2004,2010,2009,2010,2003,2003,2004,2004,2004,2005,2007,2007,2008,2008,2009,2002,2005,2005,2006,2007,2008,2010],[24,2,23,20,11,22,-9,3,29,21,31,29,24,3,5,28,-9,-9,18,10,-9,28,3,-9,24,-9,-9,3,20,23,9,20,-9,21,9,4,2,3,17,15,29,28,19,28,6,2,19,11,23,3,30,26,19,8,4,6,16,14,1,22,11,29,26,5,25,22,8,14,17,27,12,26],[4,10,12,1,12,12,5,3,7,5,12,9,3,9,5,3,10,3,7,6,8,5,4,6,2,12,4,10,8,3,11,8,11,10,10,11,5,7,8,11,9,6,4,11,11,3,9,12,9,7,11,11,3,1,7,7,4,3,1,7,6,8,10,11,2,5,5,1,12,2,3,11],[1992,1996,1993,1993,1989,1989,1990,1991,1991,1991,1991,1994,1993,1999,1994,1996,1994,2000,1999,1999,1997,1997,2000,1996,1996,2000,2000,1997,1998,2000,2000,1998,1998,2000,1995,1996,2003,2001,2001,2001,2000,1993,1999,2000,2004,2008,2002,2002,2003,2003,2004,2010,2009,2010,2003,2003,2004,2004,2005,2005,2007,2007,2008,2008,2009,2005,2005,2006,2010,2007,2009,2010],[0,1,1,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,1,1,1,0,1,0,0,0,1,1,1,0,0,1,1,1,1,1,1,0,0,1,0,1,0,0,0,1,0,1,1,1,1,1,0,1,1,1,1,0,1,0,1,1,1,0,0,0,1,1,1,1,1,1],[0,1,0,0,0,1,1,0,1,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,1,1,1,0,0,0,1,0,1,1,1,0,1,0,0,1,1,1,1,1,1,1],[0,2,0,0,0,3,2,0,2,0,0,3,0,0,0,0,0,0,2,2,2,0,0,0,0,0,2,0,2,0,0,2,0,4,0,0,2,0,0,3,0,0,0,0,0,2,0,0,2,0,2,2,2,0,0,0,2,0,2,2,2,0,2,0,0,2,2,2,2,2,2,2],[-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,1,0,3,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,-9,0,-9,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,140,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0],[0,13,17,1,0,16,16,20,15,16,16,13,7,11,11,7,0,7,7,16,15,0,7,1,0,8,15,7,16,0,7,16,7,12,11,16,20,12,7,17,7,16,0,0,0,16,0,15,7,7,7,7,7,7,16,15,17,17,7,17,15,15,16,0,16,17,16,16,16,16,17,17],[1,4,4,2,1,4,4,5,4,4,4,4,3,3,3,3,1,3,3,4,4,1,3,2,1,3,4,3,4,1,3,4,3,3,3,4,5,3,3,4,3,4,1,1,1,4,1,4,3,3,3,3,3,3,4,4,4,4,3,4,4,4,4,1,4,4,4,4,4,4,4,4],[1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,1],[4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002,4.3000002]],"container":"<table class=\"display\">\n  <thead>\n    <tr>\n      <th> <\/th>\n      <th>dispnum3<\/th>\n      <th>dispnum4<\/th>\n      <th>stabb<\/th>\n      <th>ccode<\/th>\n      <th>stday<\/th>\n      <th>stmon<\/th>\n      <th>styear<\/th>\n      <th>endday<\/th>\n      <th>endmon<\/th>\n      <th>endyear<\/th>\n      <th>sidea<\/th>\n      <th>revstate<\/th>\n      <th>revtype1<\/th>\n      <th>revtype2<\/th>\n      <th>fatality<\/th>\n      <th>fatalpre<\/th>\n      <th>hiact<\/th>\n      <th>hostlev<\/th>\n      <th>orig<\/th>\n      <th>version<\/th>\n    <\/tr>\n  <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]},{"orderable":false,"targets":0}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
</section>
<section id="mip" class="level2">
<h2 class="anchored" data-anchor-id="mip">MIP</h2>
<div class="cell" data-hash="01_DataPrep_ExistingData_cache/html/unnamed-chunk-4_1652b2aa8046a1c4e640d8d1704d97bd">
<details>
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>mip <span class="ot">&lt;-</span> readstata13<span class="sc">::</span><span class="fu">read.dta13</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(),<span class="st">"/inst/extdata/MIP/MIPDataKushiToft.dta"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(styear <span class="sc">&gt;=</span> <span class="dv">1989</span> <span class="sc">&amp;</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a>                  RemoveCase <span class="sc">==</span> <span class="dv">0</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
<p>The MIP data also covers US military interventions, broadly defined as “united instances of international conflict or potential conflict outside of normal peacetime activities in which the purposeful threat, display, or use of military force by official US government channels is explicitly directed toward the government, official representatives, official forces, property, or territory of another state actor” <span class="citation" data-cites="kushi_introducingmilitaryintervention_2022">(<a href="#ref-kushi_introducingmilitaryintervention_2022" role="doc-biblioref"><strong>kushi_introducingmilitaryintervention_2022?</strong></a>)</span>. This is inclusive of IMI (purposeful movement of troops inside another country), CRS (armed forces abroad outside of normal peacetime purposes), RAND RUGID (at least 100 ground troops in a year), MIPS (at least 500 military personnel), and MID (military force short of war).<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a></p>
</section>
<section id="mips" class="level2">
<h2 class="anchored" data-anchor-id="mips">MIPS</h2>
<p>The MIPS dataset codes Military Interventions by Powerful States from 1946-2003 <span class="citation" data-cites="sullivan_militaryinterventionpowerful_2009">(<a href="#ref-sullivan_militaryinterventionpowerful_2009" role="doc-biblioref">Sullivan and Koch 2009</a>)</span>. It includes the US, China, France, and Russia using force against state and non-state targets as well as their political objects, the costs of the operation, and the interventions outcomes. We filter the dataset so that it only includes the interventions in which the United States was an actor in the post-Cold War period.</p>
<div class="cell" data-hash="01_DataPrep_ExistingData_cache/html/unnamed-chunk-5_37f2cf3792e06c5951238ded7c765bec">
<details>
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>mips <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(),<span class="st">"/inst/extdata/MIPS/MIPS_dataset.csv"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(styr <span class="sc">&gt;=</span> <span class="dv">1989</span> <span class="sc">&amp;</span></span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a>                  MP <span class="sc">==</span> <span class="dv">2</span>)</span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(mips)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">

<div class="datatables html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-35db03568ac53655b454" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-35db03568ac53655b454">{"x":{"filter":"none","vertical":false,"data":[["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16"],[20,21,22,23,24,25,26,27,28,29,30,31,105,106,107,108],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],["USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA","USA"],["11may1989","20dec1989","14aug1990","16jan1991","03dec1992","04may1993","19sep1994","14oct1994","30aug1995","08mar1996","01feb1998","24mar1999","06apr1991","27aug1992","03sep1996","07oct2001"],["20dec1989","31jan1990","28feb1991","28feb1991","04may1993","31dec1993","31mar1995","21dec1994","21sep1995","25mar1996","20dec1998","10jun1999","19mar2003","19mar2003","19mar2003","31mar2002"],["Panama","Panama","Saudi Arabia","Kuwait","Somalia","Somalia","Haiti","Kuwait","Bosnia","Taiwan","Iraq","Yugoslavia","Iraq","Iraq","Kuwait","Afghanistan"],["PAN","PAN","SAU","KUW","SOM","SOM","HAI","KUW","BOS","TAW","IRQ","YUG","IRQ","IRQ","KUW","AFG"],[95,95,670,690,520,520,41,690,346,713,645,345,645,645,690,700],["Operation Nimrod Dancer","Operation Just Cause","Desert Shield","Desert Storm","Operation Restore Hope (UNITAF)","Operation Continue Hope (UNOSOM)","Operation Uphold Democracy","Operation Vigilant Warrior","Operation Deliberate Force","Taiwan Strait Crisis of 1995/1996","Ops Desert Thunder/ Desert Fox","Operation Allied Force/ Noble Anvil","Ops Provide Comfort/ Northern Watch","Operation Southern Watch","Desert Strike/ Kuwait deployment","Operation Enduring Freedom-Afghanistan"],[1989,1989,1990,1991,1992,1993,1994,1994,1995,1996,1998,1999,1991,1992,1996,2001],[null,null,null,211,713,null,null,null,null,null,null,null,null,null,null,null],[3901,3901,3957,3974,null,null,4016,4270,3551,4064,4273,4137,3957,3552,4271,4283],[null,2750,2750,null,2410,2410,null,null,null,null,2780,3210,null,null,null,3270],["FAS; NYT; CLOD92; BROG; BERC; GS; CIM; CRAN","NYT; CIM; BERC; CLOD92; FAS; WEIS; BROG","CIM; FAS; CLOD; BROG; HUT","CIM; DODPG; CLOD92; GS; DLNK; BROG; HUT","CIM; FAS; BROG; DLNK; ALK; BENT; CLOD","FAS; CIM; CRA; ALK; BENT; CLOD; BROG; GS","CIM; FAS; CLOD; JESS98; BERC; BENT","FAS; CDI; HERR","FAS; CDI; DLNK; CLOD; GS","FAS; WRT; BERC","FAS; CLOD92; GS; DLNK;","FAS; CDI; CLOD92; NYT; CLOD","FAS; CDI; DLNK","FAS; CDI; NYT; CRA","FAS; CDI; NYT; GS: CENT","CDI; BID; O'HAN; NYT; GS; DLINK"],["protect US citizens/ property, canal zone right of movement","regime change (oust Noriega, replace w. Endara)","deter/ defence against invasion of Saudi Arabia","push Iraq out of Kuwait","assist and protect UN humanitarian operations","peacemaking, disarm clans, capture Aidid","remove regime/ restore Aristide","deter Iraqi aggression against Kuwait/ defend Kuwait","protect safe areas, end Serb offensive, destroy capabilities","deter Chinese attack against Taiwan","degrade weapons capability/ compel cooperation w/ inspectors","halt Serbian military action in Kosovo","deter Iraqi attacks on/ protect Kurds/ enforce UNSCR 687/688","force govt to end attacks/protect Iraqi civilians (Shi'ite)/ WMD","deter aggression; protect/ defend Kuwait","remove and replace Taliban regime, destroy al Qaeda, capture bin Laden"],["policy","remove","land","land","order","order","remove","land","policy","prop","policy","policy","order","policy","land","remove"],[1,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0],["escalated","prevailed","escalated","prevailed","escalated","withdrew","prevailed","completed","negotiated","prevailed","completed","negotiated","escalated","escalated","completed","prevailed"],[0,1,1,1,1,0,1,1,1,1,1,1,0,0,1,1],[0,1,1,1,1,0,1,1,1,1,1,1,0,0,1,1],[0,1,1,1,0,0,1,0,1,1,0,1,0,0,1,1],[0,60,60,60,6,0,60,8,60,60,6,48,0,0,14,26],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],["Panamanian govt (Noriega)","Panamanian govt (Noriega)","Iraqi regime (Hussein)","Iraqi government","warring clans","Somali National Alliance (Aidid)","Haitian military regime (Cedras)","Iraqi regime (Hussein)","Bosnian Serbs","China","Iraq","Federal Republic of Yugoslavia","Iraqi government","Iraqi government","Iraq (Hussein regime)","Taliban regime"],[95,95,645,645,null,null,41,645,345,710,645,345,645,645,645,700],["PAN","PAN","IRQ","IRQ","","","HAI","IRQ","YUG","CHN","IRQ","YUG","IRQ","IRQ","IRQ","AFG"],["state","state","state","state","terrorists","terrorists","state","state","state","state","state","state","state","state","state","state"],[1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1],[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0],[0,0,1,1,1,1,1,0,1,0,1,1,1,1,1,1],[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,1,1,0,0,0,1,0,1,0,0,0,0,1,0],["show of force: infantry, mechanized, air","ground (airborne, Rangers), air","ground, airborne, air, Navy, Marines","air, sea, ground","ground, air, special ops","ground (10th Mntn), special ops, Marines","82nd airborne, 10th mountain, Navy","ground, naval, air","air strikes","USS Nimitz &amp; Independence/ 7th Fleet","navy, air, grnd buildup; air strikes","air strikes"," air patrol/ raids; special forces","air patrol/raids, naval intercept","air, sea, ground","ground/ air campaign; local proxy frcs"],["display","ground combat","limited ground","ground combat","ground combat","ground combat","ground combat","display","extensive air","display","extensive air","extensive air","limited long","limited long","limited long","ground combat"],[13597,27500,541000,541425,30000,4000,22000,29000,28000,20000,29000,7000,12316,22000,25000,60000],[3,3,4,4,4,2,3,3,3,3,3,2,3,3,3,4],[3,3,1,1,1,2,1,3,1,1,3,1,3,1,3,1],[1,1,1,1,1,1,1,1,0,0,1,0,0,0,0,1],[0,1,0,1,1,1,1,0,0,0,0,0,0,0,0,1],[223,42,198,43,152,241,193,68,22,17,322,78,4365,3856,2388,175],[7,1,6,1,5,7,6,2,1,0,10,3,143,127,78,5],[0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0],[1,26,84,269,14,29,1,0,1,0,null,2,26,null,null,49],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,345,null,40000,100,312,10,0,75000,0,1400,5000,null,null,null,10000],[1,1,0,1,0,1,0,1,1,1,1,0,1,1,1,0],[0,1,1,1,0,0,1,0,1,1,0,1,0,0,0,0],[1,1,1,1,1,0,1,1,1,1,1,1,null,null,null,1],[0,0,0,0,1,1,1,1,1,0,1,1,null,null,null,1],["maintained objective until escalation to Just Cause intervention","12k already forward deployed in Panama","enddate? attained objective?  Escalated to Desert Storm","","did improve humanitarian situation","end date?","no actual combat/ credible threat of force sufficient, single casualty was suici","ongoing?","NATO; US over 60% sorties","Number of troops? Chinese intent? US cut diplomatic ties w/ Taiwan 1979,sent 2 c","obj: destabilize regime? Cooperation w/ weapons inspectors?","NATO but US 60%; KLA on ground; peacekeeping, 725 U.S. aircraft used","peak May 21, 1991","little evidence air patrols have protected Iraqis","exclude? End date/ outcome?","include target: al Qaeda; enddate?; maintain"]],"container":"<table class=\"display\">\n  <thead>\n    <tr>\n      <th> <\/th>\n      <th>case<\/th>\n      <th>MP<\/th>\n      <th>MPalph<\/th>\n      <th>stdate<\/th>\n      <th>enddate<\/th>\n      <th>location<\/th>\n      <th>localph<\/th>\n      <th>loc<\/th>\n      <th>intervention<\/th>\n      <th>styr<\/th>\n      <th>COW<\/th>\n      <th>MID<\/th>\n      <th>UCDP<\/th>\n      <th>sources<\/th>\n      <th>object<\/th>\n      <th>objcode<\/th>\n      <th>sq<\/th>\n      <th>outcome<\/th>\n      <th>attain<\/th>\n      <th>attain6mos<\/th>\n      <th>attain1yr<\/th>\n      <th>maintain<\/th>\n      <th>mpdem<\/th>\n      <th>target<\/th>\n      <th>sttarg<\/th>\n      <th>Talpha<\/th>\n      <th>targtyp<\/th>\n      <th>state<\/th>\n      <th>T_MP<\/th>\n      <th>coalition<\/th>\n      <th>counter<\/th>\n      <th>targhelp<\/th>\n      <th>colony<\/th>\n      <th>cont<\/th>\n      <th>interst<\/th>\n      <th>forcedescrip<\/th>\n      <th>forcetyp<\/th>\n      <th>numtrps<\/th>\n      <th>trpcat<\/th>\n      <th>trpsrc<\/th>\n      <th>grndtrps<\/th>\n      <th>grndcmbt<\/th>\n      <th>days<\/th>\n      <th>mnths<\/th>\n      <th>targ_init<\/th>\n      <th>mpcas<\/th>\n      <th>cas500<\/th>\n      <th>tarcas<\/th>\n      <th>prevint<\/th>\n      <th>attain3yrs<\/th>\n      <th>post_trps<\/th>\n      <th>mnf<\/th>\n      <th>notes<\/th>\n    <\/tr>\n  <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[1,2,8,10,11,12,13,17,19,20,21,22,23,25,28,29,30,31,32,33,34,35,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52]},{"orderable":false,"targets":0}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
</section>
<section id="prio" class="level2">
<h2 class="anchored" data-anchor-id="prio">PRIO</h2>
<p>The PRIO dataset on armed conflict includes internal and external conflicts from 1946-2008 <span class="citation" data-cites="gleditsch_armedconflict19462001_2002">(<a href="#ref-gleditsch_armedconflict19462001_2002" role="doc-biblioref">Gleditsch et al. 2002</a>)</span>. We filter the dataset so that it only includes the interventions in which the United States was an actor in the post-Cold War period.</p>
<div class="cell" data-hash="01_DataPrep_ExistingData_cache/html/unnamed-chunk-6_ef5518d2dadfb0f784a7691afb3cabb4">
<details>
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a>prio <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(),<span class="st">"/inst/extdata/PRIO/UCDP-PRIO_armed_conflict_dataset.csv"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(year <span class="sc">&gt;=</span> <span class="dv">1989</span> <span class="sc">&amp;</span></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a>                  side_a_id <span class="sc">==</span> <span class="dv">3</span>) <span class="co"># PRIO does not use the GW identifier. It is confirmed that this refers to the USA</span></span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(prio)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">

<div class="datatables html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-5bf1cce17d7f5a1bd75d" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-5bf1cce17d7f5a1bd75d">{"x":{"filter":"none","vertical":false,"data":[["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],[418,418,418,418,418,418,418,418,418,418,418,418,418,418,418,418,418],["United States of America","United States of America","United States of America","United States of America","United States of America","United States of America","United States of America","United States of America","United States of America","United States of America","United States of America","United States of America","United States of America","United States of America","United States of America","United States of America","United States of America"],["Government of United States of America","Government of United States of America","Government of United States of America","Government of United States of America","Government of United States of America","Government of United States of America","Government of United States of America","Government of United States of America","Government of United States of America","Government of United States of America","Government of United States of America","Government of United States of America","Government of United States of America","Government of United States of America","Government of United States of America","Government of United States of America","Government of United States of America"],["3","3","3","3","3","3","3","3","3","3","3","3","3","3","3","3","3"],["Government of Australia, Government of Canada, Government of France, Government of Germany, Government of Italy, Government of Poland, Government of Turkey, Government of United Kingdom","Government of Afghanistan, Government of Australia, Government of Canada, Government of Denmark, Government of France, Government of Germany, Government of Greece, Government of Italy, Government of Japan, Government of Jordan, Government of Lithuania, Government of Netherlands, Government of New Zealand, Government of Norway, Government of Pakistan, Government of Poland, Government of Rumania, Government of Spain, Government of Turkey, Government of United Kingdom","Government of Afghanistan, Government of Canada, Government of Denmark, Government of France, Government of Italy, Government of Lithuania, Government of Netherlands, Government of New Zealand, Government of Norway, Government of Pakistan, Government of Poland, Government of Rumania, Government of Slovakia, Government of Spain, Government of United Kingdom","Government of Afghanistan, Government of Belgium, Government of Canada, Government of Czech Republic, Government of France, Government of Germany, Government of Italy, Government of Pakistan, Government of Poland, Government of Portugal, Government of Rumania, Government of Saudi Arabia, Government of Slovakia, Government of Spain, Government of United Kingdom","Government of Belgium, Government of Canada, Government of Croatia, Government of Denmark, Government of Estonia, Government of France, Government of Italy, Government of Kuwait, Government of Netherlands, Government of Norway, Government of Pakistan, Government of Poland, Government of Rumania, Government of Saudi Arabia, Government of Slovakia, Government of Spain, Government of United Kingdom","Government of Afghanistan, Government of Pakistan, Government of Saudi Arabia, Government of United Kingdom","Government of Afghanistan, Government of Pakistan, Government of Saudi Arabia, Government of United Kingdom","Government of Afghanistan, Government of Czech Republic, Government of Pakistan, Government of Rumania","Government of Afghanistan, Government of Canada, Government of Czech Republic, Government of France, Government of Jordan, Government of Netherlands, Government of Pakistan, Government of Rumania","Government of Afghanistan, Government of Canada, Government of France, Government of Jordan, Government of Netherlands, Government of Pakistan, Government of Rumania","Government of Afghanistan, Government of France, Government of Jordan, Government of Pakistan","Government of Afghanistan, Government of France, Government of Jordan, Government of Pakistan","Government of Afghanistan, Government of Jordan, Government of Pakistan","Government of Afghanistan, Government of Pakistan","Government of Afghanistan, Government of Pakistan","Government of Afghanistan, Government of Pakistan","Government of Afghanistan, Government of Pakistan"],["al-Qaida ","al-Qaida ","al-Qaida ","al-Qaida ","al-Qaida ","al-Qaida ","al-Qaida ","al-Qaida ","al-Qaida ","al-Qaida ","al-Qaida ","al-Qaida ","al-Qaida ","al-Qaida ","al-Qaida ","al-Qaida ","al-Qaida "],["769","769","769","769","769","769","769","769","769","769","769","769","769","769","769","769","769"],["","","","","","","","","","","","","","","","",""],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],["","","","","","","","","","","","","","","","",""],[2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017],[2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4],["9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001"],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],["9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001","9/11/2001"],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],["","","","","","","","","","","","","","","","","12/4/2017"],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],["2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2"],["900, 20, 220, 260, 325, 290, 640, 200","700, 900, 20, 390, 220, 260, 350, 325, 740, 663, 368, 210, 920, 385, 770, 290, 360, 230, 640, 200","700, 20, 390, 220, 325, 368, 210, 920, 385, 770, 290, 360, 317, 230, 200","700, 211, 20, 316, 220, 260, 325, 770, 290, 235, 360, 670, 317, 230, 200","211, 20, 344, 390, 366, 220, 325, 690, 210, 385, 770, 290, 360, 670, 317, 230, 200","700, 770, 670, 200","700, 770, 670, 200","700, 316, 770, 360","700, 20, 316, 220, 663, 210, 770, 360","700, 20, 220, 663, 210, 770, 360","700, 220, 663, 770","700, 220, 663, 770","700, 663, 770","700, 770","700, 770","700, 770","700, 770"],["","","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","","",""],["2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2"],["5","5","5","5","5","5","5","5","5","5","5","5","5","5","5","5","5"],[19.1,19.1,19.1,19.1,19.1,19.1,19.1,19.1,19.1,19.1,19.1,19.1,19.1,19.1,19.1,19.1,19.1]],"container":"<table class=\"display\">\n  <thead>\n    <tr>\n      <th> <\/th>\n      <th>conflict_id<\/th>\n      <th>location<\/th>\n      <th>side_a<\/th>\n      <th>side_a_id<\/th>\n      <th>side_a_2nd<\/th>\n      <th>side_b<\/th>\n      <th>side_b_id<\/th>\n      <th>side_b_2nd<\/th>\n      <th>incompatibility<\/th>\n      <th>territory_name<\/th>\n      <th>year<\/th>\n      <th>intensity_level<\/th>\n      <th>cumulative_intensity<\/th>\n      <th>type_of_conflict<\/th>\n      <th>start_date<\/th>\n      <th>start_prec<\/th>\n      <th>start_date2<\/th>\n      <th>start_prec2<\/th>\n      <th>ep_end<\/th>\n      <th>ep_end_date<\/th>\n      <th>ep_end_prec<\/th>\n      <th>gwno_a<\/th>\n      <th>gwno_a_2nd<\/th>\n      <th>gwno_b<\/th>\n      <th>gwno_b_2nd<\/th>\n      <th>gwno_loc<\/th>\n      <th>region<\/th>\n      <th>version<\/th>\n    <\/tr>\n  <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[1,9,11,12,13,14,16,18,19,28]},{"orderable":false,"targets":0}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
</section>
<section id="rand" class="level2">
<h2 class="anchored" data-anchor-id="rand">RAND</h2>
<p>RAND has a forthcoming dataset on US military interventions from 1898-2016 <span class="citation" data-cites="kavanagh_characteristicssuccessfulmilitary_2019">(<a href="#ref-kavanagh_characteristicssuccessfulmilitary_2019" role="doc-biblioref">Kavanagh et al. 2019</a>)</span>. Because the raw data is not yet public, the list of cases is taken from their appendix and copied into a dataframe. We filter the dataset so that it only includes the interventions in the post-Cold War period.</p>
<div class="cell" data-hash="01_DataPrep_ExistingData_cache/html/unnamed-chunk-7_365aba7a922a583bbe05fe6b031966de">
<details>
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>rand <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(),<span class="st">"/inst/extdata/rand_interventionlist.csv"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(incident_start_year <span class="sc">&gt;=</span> <span class="dv">1989</span>)</span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(rand)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">

<div class="datatables html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-b249e47e5bec417365f1" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-b249e47e5bec417365f1">{"x":{"filter":"none","vertical":false,"data":[["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64"],["Operation Desert Storm","Task Force Freedom","Operation Provide Comfort","Operation Northern Watch","Operation Sea Angel","Operation Safe Harbor","IFOR","SFOR","EUFOR","Operation Restore Hope","Operation Continue Hope","Operation United Shield","Operation Southern Watch ","Operation Vigilant Warrior","Operation Vigilant Sentinel","Operation Desert Strike","Operation Desert Thunder ","Operation Desert Fox ","Operation Desert Focus ","Exercise Intrinsic Action/Desert Spring","Exercise Iris Gold","Operation Sea Signal ","Operation Safe Haven ","Operation Safe Passage","Operation Support Hope","Operation Uphold Democracy ","Operation New Horizons","Operation Assured Response","Operation Infinite Reach","Operation Strong Support/Fuerte Apoyo","Plan Colombia","Operation Allied Force","Operation Noble Anvil","Operation Sustain Hope","Operation Shining Hope","Multinational Peacekeeping Force in Kosovo","Operation Avid Response","Operation Atlas Response","Operation Enduring Freedom","Operation Swift Freedom","Operation Enduring Freedom","International Security Assistance Force","Operation Freedom's Sentinel","Operation Resolute Support","Joint Task Force Horn of Africa","Operation Iraqi Freedom","Operation New Dawn","Joint Task Force Liberia","Operation Secure Tomorrow","Operation Unified Assistance","Operation Lifeline","Operation Unified Response","Flood Relief in Pakistan","Deterrence of China in Japan","Operation Odyssey Dawn","Operation Unified Protector","Operation Tomodachi","U.S. Military Support to African-Led Counter–Lord’s Resistance Army Operations","Typhoon Humanitarian Relief in the Philippines","Operation Atlantic Resolve","U.S. Military Support to African-Led Counter–Boko Haram Operations","Operation Inherent Resolve","Operation United Assistance","Anti-ISIL Air Strikes in Libya"],["Persian Gulf War","U.S. Peacekeeping Force in Kuwait","U.S. Peacekeeping and Deterrent Force in Turkey and Northern Iraq","U.S. Peacekeeping and Deterrent Force in Turkey and Northern Iraq","Cyclone Relief in Bangladesh","Haitian Refugee Relief in Cuba","Bosnian Air Campaign, Multinational Peacekeeping Force in the Balkans","Bosnian Air Campaign, Multinational Peacekeeping Force in the Balkans","Bosnian Air Campaign, Multinational Peacekeeping Force in the Balkans","Multinational Peacekeeping Force in Somalia","Multinational Peacekeeping Force in Somalia","Multinational Peacekeeping Force in Somalia","U.S. Deterrent and Training Force in the Persian Gulf","U.S. Deterrent and Training Force in the Persian Gulf","U.S. Deterrent and Training Force in the Persian Gulf","U.S. Deterrent and Training Force in the Persian Gulf","U.S. Deterrent and Training Force in the Persian Gulf","U.S. Deterrent and Training Force in the Persian Gulf","U.S. Deterrent and Training Force in the Persian Gulf","U.S. Deterrent and Training Force in the Persian Gulf","U.S. Deterrent and Training Force in the Persian Gulf","Haitian and Cuban Refugee Relief","Haitian and Cuban Refugee Relief","Haitian and Cuban Refugee Relief","Rwandan Genocide Relief Mission","U.S. Nation-Building Operations in Haiti","U.S. Nation-Building Operations in Haiti","U.S. Security Force in Liberia","Cruise Missile Attacks on al Qaeda ","Hurricane Relief in Central America","U.S. COIN and Counternarcotics Advisory and Assistance in Colombia","Kosovo Air Campaign","Kosovo Air Campaign","Kosovo Air Campaign","Kosovo Air Campaign","Multinational Peacekeeping Force in Kosovo","Earthquake Relief in Turkey","Flood Relief in Mozambique","U.S. Overthrow of the Taliban Regime","U.S. Overthrow of the Taliban Regime","U.S. Occupation of Afghanistan","U.S. Occupation of Afghanistan","U.S. Occupation of Afghanistan","U.S. Occupation of Afghanistan","Joint Task Force Horn of Africa","U.S. Invasion of Iraq","U.S. Occupation of Iraq","U.S. Peacekeeping Force in Liberia","Multinational Peacekeeping Force in Haiti","Tsunami Relief in the Indian Ocean","Earthquake Relief in Pakistan","Earthquake Relief in Haiti","Flood Relief in Pakistan","Deterrence of China in Japan","Air Campaign to Overthrow Gaddaf","Air Campaign to Overthrow Gaddaf","Earthquake and Tsunami Relief in Japan","U.S. Military Support to African-Led Counter–Lord’s Resistance Army Operations","Typhoon Humanitarian Relief in the Philippines","Baltics and Black Sea Deterrence","U.S. Military Support to African-Led Counter–Boko Haram Operations","Combined Joint Task Force Against the Islamic State","Ebola Relief in West Africa","Anti-ISIL Air Strikes in Libya"],["Iraq","Kuwait","Turkey","Iraq","Bangladesh","Cuba","Bosnia","Bosnia and Herzegovina","Bosnia and Herzegovina","Somalia","Somalia","Somalia","","","","","","","","","","","","","Rwanda","Haiti","Haiti","Liberia","","","Colombia","Kosovo","Kosovo","Kosovo","Kosovo","Kosovo","Turkey","Mozambique","","","Afghanistan","Afghanistan","Afghanistan","Afghanistan","","Iraq","Iraq","Liberia","Haiti","","Pakistan","Haiti","Pakistan","China","","","Japan","","Philippines","","","","","Libya"],[1991,1991,1991,1991,1991,1991,1995,1996,2004,1992,1992,1992,1992,1992,1992,1992,1992,1992,1992,1992,1992,1994,1994,1994,1994,1994,1994,1996,1998,1998,1999,1999,1999,1999,1999,1999,1999,2000,2001,2001,2001,2001,2001,2001,2002,2003,2003,2003,2004,2004,2005,2010,2010,2010,2011,2011,2011,2011,2013,2014,2014,2014,2014,2016],[1991,1991,2003,2003,1991,1993,1996,2004,null,1995,1995,1995,2003,2003,2003,2003,2003,2003,2003,2003,2003,1996,1996,1996,1994,1996,1996,1996,1998,1999,null,1999,1999,1999,1999,null,1999,2000,2001,2001,null,null,null,null,null,2003,2011,2003,2004,2005,2006,2010,2010,null,2011,2011,2011,2017,2013,null,null,null,2015,null]],"container":"<table class=\"display\">\n  <thead>\n    <tr>\n      <th> <\/th>\n      <th>operation_name<\/th>\n      <th>operation_description<\/th>\n      <th>target_country<\/th>\n      <th>incident_start_year<\/th>\n      <th>incident_end_year<\/th>\n    <\/tr>\n  <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[4,5]},{"orderable":false,"targets":0}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
</section>
<section id="aerial-bombing" class="level2">
<h2 class="anchored" data-anchor-id="aerial-bombing">Aerial bombing</h2>
<p>A number of other datasets on aerial bombing analyze similar conflicts and contain variables of interest. We can make our dataset compatible with those. The next task is to make them compatible by subsetting to just US aerial bombing cases and checking the unit of analysis. We’ll start with <span class="citation" data-cites="allen_understandingimpactair_2017">(<a href="#ref-allen_understandingimpactair_2017" role="doc-biblioref"><strong>allen_understandingimpactair_2017?</strong></a>)</span> and <span class="citation" data-cites="horowitz_whendoesaerial_2001">Horowitz and Reiter (<a href="#ref-horowitz_whendoesaerial_2001" role="doc-biblioref">2001</a>)</span>.</p>
<p>The war ID’s only have a partial match to one another and not every cruise missile bombing has a COW code so we will have to make a new campaign variable for each dataset to merge the cases. Since the unique rows in our new dataset is smaller, we’ll change the names in the other datasets to match the equivalents in the new cruise missile data. In this case, that will be the wikidata ID. That has the advantage of being uniform since it’s an external source and can be merged using unique IDs later which will help make the data compatible with other datasets. This will allow us to then merge on the war_wikidata_name variable.</p>
<p>While <span class="citation" data-cites="allen_understandingimpactair_2017">(<a href="#ref-allen_understandingimpactair_2017" role="doc-biblioref"><strong>allen_understandingimpactair_2017?</strong></a>)</span> has unique war names that correspond fairly closely with those in the cruise missile dataset, the other datasets do not so that will have to be manually added. Confirming that’s the case, we can re-name those levels to be consistent with the corresponding column in the cruise missile data.</p>
<p><span class="citation" data-cites="horowitz_whendoesaerial_2001">Horowitz and Reiter (<a href="#ref-horowitz_whendoesaerial_2001" role="doc-biblioref">2001</a>)</span> build on <span class="citation" data-cites="pape_bombingwinair_1996">Pape (<a href="#ref-pape_bombingwinair_1996" role="doc-biblioref">1996</a>)</span>’s work to test whether air power will succeed in accomplishing foreign policy objectives by testing theories about target regime type and demand for regime change. They add more cases that represent instance of aerial bombing both after Pape’s work was published and also cases he missed. Similar to <span class="citation" data-cites="pape_bombingwinair_1996">Pape (<a href="#ref-pape_bombingwinair_1996" role="doc-biblioref">1996</a>)</span>, they seek to explain success in aerial bombing and argue that when the target is militarily vulnerable, air power will succeed. The civilian vulnerability of the target does not matter. Air power works less well if the attacker demands that the target government step down and it does not matter if the target is democratic.</p>
<div class="cell" data-hash="01_DataPrep_ExistingData_cache/html/unnamed-chunk-8_2f603128291fba828de5c50a480012f8">
<details>
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Prep Allen data</span></span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a>allen_17 <span class="ot">&lt;-</span> readstata13<span class="sc">::</span><span class="fu">read.dta13</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(), <span class="st">"/inst/extdata/AllenMtzMachainAerialBombingData2016CMPS.dta"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(year <span class="sc">&gt;=</span> <span class="dv">1989</span> <span class="sc">&amp;</span></span>
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a>                  ccode1 <span class="sc">==</span> <span class="dv">2</span> <span class="sc">&amp;</span></span>
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true" tabindex="-1"></a>                  bomb <span class="sc">==</span> <span class="dv">1</span>) <span class="sc">%&gt;%</span></span>
<span id="cb8-6"><a href="#cb8-6" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">war_wikidata_name =</span> war) <span class="sc">%&gt;%</span></span>
<span id="cb8-7"><a href="#cb8-7" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">war_wikidata_name =</span> dplyr<span class="sc">::</span><span class="fu">recode</span>(war_wikidata_name,</span>
<span id="cb8-8"><a href="#cb8-8" aria-hidden="true" tabindex="-1"></a>                                           <span class="st">"WWI"</span> <span class="ot">=</span> <span class="st">"World War I"</span>, </span>
<span id="cb8-9"><a href="#cb8-9" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"WWII"</span> <span class="ot">=</span> <span class="st">"World War II"</span>, </span>
<span id="cb8-10"><a href="#cb8-10" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"Korean War"</span> <span class="ot">=</span> <span class="st">"Korean War"</span>, </span>
<span id="cb8-11"><a href="#cb8-11" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"Vietnam Phase 2"</span> <span class="ot">=</span> <span class="st">"Vietnam War"</span>,</span>
<span id="cb8-12"><a href="#cb8-12" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"Vietnam (163)"</span> <span class="ot">=</span> <span class="st">"Vietnam War"</span>,</span>
<span id="cb8-13"><a href="#cb8-13" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"Vietnam"</span> <span class="ot">=</span> <span class="st">"Vietnam War"</span>,</span>
<span id="cb8-14"><a href="#cb8-14" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"Vietnam Phase2"</span> <span class="ot">=</span> <span class="st">"Vietnam War"</span>, </span>
<span id="cb8-15"><a href="#cb8-15" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"Second Laotian (170)"</span> <span class="ot">=</span> <span class="st">"Laotian Civil War"</span>,</span>
<span id="cb8-16"><a href="#cb8-16" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"2nd Laotian War, ph 2"</span> <span class="ot">=</span> <span class="st">"Laotian Civil War"</span>,</span>
<span id="cb8-17"><a href="#cb8-17" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"Gulf War"</span> <span class="ot">=</span> <span class="st">"Gulf War"</span>,</span>
<span id="cb8-18"><a href="#cb8-18" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"War for Kosovo"</span> <span class="ot">=</span> <span class="st">"Kosovo War"</span>,</span>
<span id="cb8-19"><a href="#cb8-19" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"Invasion of Afghanistan"</span> <span class="ot">=</span> <span class="st">"War in Afghanistan"</span>,</span>
<span id="cb8-20"><a href="#cb8-20" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"Invasion of Iraq"</span> <span class="ot">=</span> <span class="st">"Iraq War"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb8-21"><a href="#cb8-21" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">allen =</span> <span class="dv">1</span>)</span>
<span id="cb8-22"><a href="#cb8-22" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-23"><a href="#cb8-23" aria-hidden="true" tabindex="-1"></a><span class="co"># Prep Horowitz data</span></span>
<span id="cb8-24"><a href="#cb8-24" aria-hidden="true" tabindex="-1"></a>horowitz_01 <span class="ot">&lt;-</span> foreign<span class="sc">::</span><span class="fu">read.dta</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(), <span class="st">"/inst/extdata/jcr01.dta"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb8-25"><a href="#cb8-25" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(attacker <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">'United States'</span>, <span class="st">'Allies'</span>, <span class="st">'U.S./Britain'</span>, <span class="st">'NATO'</span>, <span class="st">'US'</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb8-26"><a href="#cb8-26" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">date =</span> dplyr<span class="sc">::</span><span class="fu">recode</span>(date,</span>
<span id="cb8-27"><a href="#cb8-27" aria-hidden="true" tabindex="-1"></a>                                     <span class="st">'1944-1945'</span> <span class="ot">=</span> <span class="st">"1944"</span>,</span>
<span id="cb8-28"><a href="#cb8-28" aria-hidden="true" tabindex="-1"></a>                                     <span class="st">'1942-1944'</span> <span class="ot">=</span> <span class="st">"1942"</span>,</span>
<span id="cb8-29"><a href="#cb8-29" aria-hidden="true" tabindex="-1"></a>                                     <span class="st">'Aug. 1945'</span> <span class="ot">=</span> <span class="st">"1945"</span>,</span>
<span id="cb8-30"><a href="#cb8-30" aria-hidden="true" tabindex="-1"></a>                                     <span class="st">'1965-1968'</span> <span class="ot">=</span> <span class="st">"1965"</span>,</span>
<span id="cb8-31"><a href="#cb8-31" aria-hidden="true" tabindex="-1"></a>                                     <span class="st">'1950-1951'</span> <span class="ot">=</span> <span class="st">"1950"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb8-32"><a href="#cb8-32" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">date =</span> <span class="fu">as.numeric</span>(date)) <span class="sc">%&gt;%</span></span>
<span id="cb8-33"><a href="#cb8-33" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(date <span class="sc">&gt;=</span> <span class="dv">1989</span>) <span class="sc">%&gt;%</span></span>
<span id="cb8-34"><a href="#cb8-34" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">war_wikidata_name =</span> warid) <span class="sc">%&gt;%</span></span>
<span id="cb8-35"><a href="#cb8-35" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">war_wikidata_name =</span> <span class="fu">ifelse</span>(date <span class="sc">==</span> <span class="st">"1991"</span>, <span class="st">"Gulf War"</span>, war_wikidata_name),</span>
<span id="cb8-36"><a href="#cb8-36" aria-hidden="true" tabindex="-1"></a>                <span class="at">war_wikidata_name =</span> <span class="fu">ifelse</span>(date <span class="sc">==</span> <span class="st">"1996"</span>, <span class="st">"Iraqi Kurdish Civil War"</span>, war_wikidata_name),</span>
<span id="cb8-37"><a href="#cb8-37" aria-hidden="true" tabindex="-1"></a>                <span class="at">war_wikidata_name =</span> <span class="fu">ifelse</span>(date <span class="sc">==</span> <span class="st">"1998"</span>, <span class="st">"Iraqi no-fly zones"</span>, war_wikidata_name)) <span class="sc">%&gt;%</span></span>
<span id="cb8-38"><a href="#cb8-38" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">horowitz =</span> <span class="dv">1</span>)</span>
<span id="cb8-39"><a href="#cb8-39" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-40"><a href="#cb8-40" aria-hidden="true" tabindex="-1"></a><span class="co"># Merge together</span></span>
<span id="cb8-41"><a href="#cb8-41" aria-hidden="true" tabindex="-1"></a>aerial_prior <span class="ot">&lt;-</span> dplyr<span class="sc">::</span><span class="fu">full_join</span>(allen_17, horowitz_01) <span class="sc">%&gt;%</span></span>
<span id="cb8-42"><a href="#cb8-42" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">allen =</span> <span class="fu">ifelse</span>(<span class="fu">is.na</span>(allen), <span class="dv">0</span>, <span class="dv">1</span>),</span>
<span id="cb8-43"><a href="#cb8-43" aria-hidden="true" tabindex="-1"></a>                <span class="at">horowitz =</span> <span class="fu">ifelse</span>(<span class="fu">is.na</span>(horowitz), <span class="dv">0</span>, <span class="dv">1</span>))</span>
<span id="cb8-44"><a href="#cb8-44" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-45"><a href="#cb8-45" aria-hidden="true" tabindex="-1"></a><span class="do">### AG pick up here by adding more mods to the aerial prior in the above section</span></span>
<span id="cb8-46"><a href="#cb8-46" aria-hidden="true" tabindex="-1"></a><span class="do">### Attacker ccode</span></span>
<span id="cb8-47"><a href="#cb8-47" aria-hidden="true" tabindex="-1"></a>aerial_prior<span class="sc">$</span>ccode1 <span class="ot">&lt;-</span> <span class="dv">2</span></span>
<span id="cb8-48"><a href="#cb8-48" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-49"><a href="#cb8-49" aria-hidden="true" tabindex="-1"></a><span class="do">### Defender ccode</span></span>
<span id="cb8-50"><a href="#cb8-50" aria-hidden="true" tabindex="-1"></a>aerial_prior<span class="sc">$</span>ccode2_merge <span class="ot">&lt;-</span> countrycode<span class="sc">::</span><span class="fu">countrycode</span>(aerial_prior<span class="sc">$</span>defender, <span class="st">"country.name"</span>, <span class="st">"cown"</span>)</span>
<span id="cb8-51"><a href="#cb8-51" aria-hidden="true" tabindex="-1"></a>aerial_prior<span class="sc">$</span>ccode2 <span class="ot">&lt;-</span> <span class="fu">ifelse</span>(<span class="fu">is.na</span>(aerial_prior<span class="sc">$</span>ccode2), aerial_prior<span class="sc">$</span>ccode2_merge, aerial_prior<span class="sc">$</span>ccode2)</span>
<span id="cb8-52"><a href="#cb8-52" aria-hidden="true" tabindex="-1"></a>aerial_prior<span class="sc">$</span>ccode2_merge <span class="ot">&lt;-</span> <span class="cn">NULL</span></span>
<span id="cb8-53"><a href="#cb8-53" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-54"><a href="#cb8-54" aria-hidden="true" tabindex="-1"></a><span class="do">### Defender name</span></span>
<span id="cb8-55"><a href="#cb8-55" aria-hidden="true" tabindex="-1"></a>aerial_prior<span class="sc">$</span>defender2_merge <span class="ot">&lt;-</span> countrycode<span class="sc">::</span><span class="fu">countrycode</span>(aerial_prior<span class="sc">$</span>ccode2, <span class="st">"cown"</span>, <span class="st">"country.name"</span>)</span>
<span id="cb8-56"><a href="#cb8-56" aria-hidden="true" tabindex="-1"></a>aerial_prior<span class="sc">$</span>defender2 <span class="ot">&lt;-</span> <span class="fu">ifelse</span>(<span class="fu">is.na</span>(aerial_prior<span class="sc">$</span>defender2), aerial_prior<span class="sc">$</span>defender2_merge, aerial_prior<span class="sc">$</span>defender2)</span>
<span id="cb8-57"><a href="#cb8-57" aria-hidden="true" tabindex="-1"></a>aerial_prior<span class="sc">$</span>defender2_merge <span class="ot">&lt;-</span> <span class="cn">NULL</span></span>
<span id="cb8-58"><a href="#cb8-58" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-59"><a href="#cb8-59" aria-hidden="true" tabindex="-1"></a>aerial_prior <span class="sc">%&gt;%</span></span>
<span id="cb8-60"><a href="#cb8-60" aria-hidden="true" tabindex="-1"></a>  DT<span class="sc">::</span><span class="fu">datatable</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">

<div class="datatables html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-8dd6431c8cf27a936a39" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-8dd6431c8cf27a936a39">{"x":{"filter":"none","vertical":false,"data":[["1","2","3","4","5","6","7","8","9"],[2,2,2,2,2,2,2,2,2],[645,345,700,645,645,645,345,346,645],[1991,1999,2001,2003,null,null,null,null,null],["Gulf War","War for Kosovo","Invasion of Afghanistan","Invasion of Iraq",null,null,null,null,null],[211,221,225,227,null,null,null,null,null],[0.135599002242088,0.142887994647026,0.142012000083923,0.142094001173973,null,null,null,null,null],[1,1,1,1,null,null,null,null,null],[10,10,10,10,null,null,null,null,null],[0.00826300028711557,0.00196300004608929,0.00121200003195554,0.00662699993699789,null,null,null,null,null],[0,0,0,0,null,null,null,null,null],[-9,null,null,null,null,null,null,null,null],[1,1,1,1,null,null,null,null,null],[0.135599002242088,0.142887994647026,0.142012000083923,0.142094001173973,null,null,null,null,null],[10,10,10,10,null,null,null,null,null],[0.00826300028711557,0.00196300004608929,0.00121200003195554,0.00662699993699789,null,null,null,null,null],[-9,-6,null,null,null,null,null,null,null],[16.4103832244873,72.7906188964844,117.171615600586,21.4416790008545,null,null,null,null,null],[0,0,0,0,null,null,null,null,null],[1.5,2.5,3,8.5,null,null,null,null,null],[1,0,1,1,null,null,null,null,null],[9,9,10,10,null,null,null,null,null],[0,0,0,1,null,null,null,null,null],[0,1,0,0,null,null,null,null,null],[1,0,1,1,null,null,null,null,null],[0,0,0,0,null,null,null,null,null],[1,0,1,1,null,null,null,null,null],[1,1,0,1,null,null,null,null,null],["US","US/NATO","US","US","U.S./Britain","Allies","NATO","NATO","US"],["Gulf War - US &amp; Allies","Kosovo - Nato Allies","Operation Enduring Freedom","Iraq Regime Change - US &amp; allies",null,null,null,null,null],["Iraq","FRY","Afghanistan","Iraq",null,null,null,null,null],[2110,1490,1368,1427,null,null,null,null,null],[262388992,292147008,322364992,404920000,null,null,null,null,null],[4041865,5043448,5224415,5394710,null,null,null,null,null],[79738,97427,90104,93677,null,null,null,null,null],[64814,70642,76419,78621,null,null,null,null,null],[252618,276218,285112,290448,null,null,null,null,null],[475,105,null,389,null,null,null,null,null],[12900000,1654000,245000,null,null,null,null,null,null],[25243.609375,24139.98046875,754.351684570312,44377.859375,null,null,null,null,null],[0,230,0,0,null,null,null,null,null],[13650,3251,4162,18313,null,null,null,null,null],[18514,10637,22080,26340,null,null,null,null,null],[9,9,10,10,null,null,null,null,null],[6,6,6,null,null,null,null,null,null],[6199,4719,6929,6199,null,null,null,null,null],[1,1,1,1,null,null,null,null,null],[0,0,1,1,null,null,null,null,null],[1,1,1,1,null,null,null,null,null],[1907,1907,1907,1907,null,null,null,null,null],[1,1,1,1,null,null,null,null,null],[0.135599002242088,0.142887994647026,0.142012000083923,null,null,null,null,null,null],[1,1,1,null,null,null,null,null,null],[0.00826300028711557,0.00196300004608929,0.00121200003195554,null,null,null,null,null,null],[0,0,0,null,null,null,null,null,null],[3964081,3996001,4004001,4012009,null,null,null,null,null],[7892485120,7988005888,8012005888,8036054016,null,null,null,null,null],[1,1,1,1,null,null,null,null,null],[0,0,0,0,null,null,null,null,null],["Gulf War","Kosovo War","War in Afghanistan","Iraq War","Iraqi no-fly zones","Gulf War","51","48","Iraqi Kurdish Civil War"],[1,1,1,1,0,0,0,0,0],[null,null,null,null,1998,1991,1999,1995,1996],[null,null,null,null,45,45,51,48,45],[null,null,null,null,"Iraq","Iraq","Yugoslavia","Bosnian Serbs","Iraq"],[null,null,null,null,0,1,1,1,1],[null,null,null,null,0,1,1,1,1],[null,null,null,null,0,0,0,0,0],[null,null,null,null,0,0,0,0,0],[null,null,null,null,4,4,4,4,4],[null,null,null,null,0,0,1,1,0],[null,null,null,null,0,0,0,0,0],[null,null,null,null,1,1,1,1,1],[null,null,null,null,3,4,3,4,4],[null,null,null,null,1,2,2,1,1],[null,null,null,null,1,1,1,1,1],[0,0,0,0,1,1,1,1,1],["Iraq","Yugoslavia","Afghanistan","Iraq","Iraq","Iraq","Yugoslavia","Bosnia &amp; Herzegovina","Iraq"]],"container":"<table class=\"display\">\n  <thead>\n    <tr>\n      <th> <\/th>\n      <th>ccode1<\/th>\n      <th>ccode2<\/th>\n      <th>year<\/th>\n      <th>war<\/th>\n      <th>cowwar<\/th>\n      <th>cap1<\/th>\n      <th>majpow1<\/th>\n      <th>dem1<\/th>\n      <th>cap2<\/th>\n      <th>majpow2<\/th>\n      <th>dem2<\/th>\n      <th>bomb<\/th>\n      <th>cap1a<\/th>\n      <th>polity1<\/th>\n      <th>cap2a<\/th>\n      <th>polity2<\/th>\n      <th>caprat<\/th>\n      <th>rebel<\/th>\n      <th>dur<\/th>\n      <th>othforces<\/th>\n      <th>decade<\/th>\n      <th>gravity<\/th>\n      <th>mixed<\/th>\n      <th>pureden<\/th>\n      <th>purepun<\/th>\n      <th>polout<\/th>\n      <th>milout<\/th>\n      <th>attacker<\/th>\n      <th>campaign<\/th>\n      <th>target<\/th>\n      <th>milper1<\/th>\n      <th>milex1<\/th>\n      <th>energy1<\/th>\n      <th>irst1<\/th>\n      <th>upop1<\/th>\n      <th>tpop1<\/th>\n      <th>milper2<\/th>\n      <th>milex2<\/th>\n      <th>energy2<\/th>\n      <th>irst2<\/th>\n      <th>upop2<\/th>\n      <th>tpop2<\/th>\n      <th>timeperiod<\/th>\n      <th>contig<\/th>\n      <th>distance<\/th>\n      <th>dem6a<\/th>\n      <th>dem6b<\/th>\n      <th>nukes<\/th>\n      <th>afdate<\/th>\n      <th>airpossible<\/th>\n      <th>attackcap<\/th>\n      <th>attackmajpow<\/th>\n      <th>targetcap<\/th>\n      <th>targetmajpow<\/th>\n      <th>year2<\/th>\n      <th>year3<\/th>\n      <th>major1<\/th>\n      <th>major2<\/th>\n      <th>war_wikidata_name<\/th>\n      <th>allen<\/th>\n      <th>date<\/th>\n      <th>warid<\/th>\n      <th>defender<\/th>\n      <th>othrfrce<\/th>\n      <th>outcome<\/th>\n      <th>democ<\/th>\n      <th>industry<\/th>\n      <th>wattdenv<\/th>\n      <th>wattout<\/th>\n      <th>demand<\/th>\n      <th>sanction<\/th>\n      <th>denial<\/th>\n      <th>punish<\/th>\n      <th>nuclear<\/th>\n      <th>horowitz<\/th>\n      <th>defender2<\/th>\n    <\/tr>\n  <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,61,62,64,65,66,67,68,69,70,71,72,73,74,75]},{"orderable":false,"targets":0}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
</section>
</section>
<section id="merge" class="level1">
<h1>Merge</h1>
<p>Now that we know the interventions each dataset identifies for the US post-1989, we can compare them and see what cases each one covers. Then we merge those cases to get a non-duplicated list of interventions for which we want to identify the campaigns and operations. Each dataset should have each US intervention as a unique row.</p>
<p>Rather than trying to manually merge each dataset to one another, the easiest method will be merging each observation from each dataset to the Q code for that event. Then we see which Q codes match up</p>
<p>We subset to only variables useful for Q code identification To help coders identify the ccode for each observation, we’ll want the name provided by the dataset, target country, and date.</p>
<div class="cell" data-hash="01_DataPrep_ExistingData_cache/html/unnamed-chunk-9_60dab625168f22045b597e9075fda8db">
<details>
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb9"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="co"># ICB</span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="do">## Subset to relevant columns</span></span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a>icb_id <span class="ot">&lt;-</span> icb[ , <span class="fu">c</span>(<span class="st">'yrtrig'</span>, <span class="st">'crisname'</span>)]</span>
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true" tabindex="-1"></a><span class="do">## Standardize column names</span></span>
<span id="cb9-6"><a href="#cb9-6" aria-hidden="true" tabindex="-1"></a>icb_id <span class="ot">&lt;-</span> icb_id <span class="sc">%&gt;%</span> dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="st">'Year'</span> <span class="ot">=</span> yrtrig,</span>
<span id="cb9-7"><a href="#cb9-7" aria-hidden="true" tabindex="-1"></a>                                   <span class="st">'Intervention'</span> <span class="ot">=</span> crisname)</span>
<span id="cb9-8"><a href="#cb9-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-9"><a href="#cb9-9" aria-hidden="true" tabindex="-1"></a><span class="do">## Create identifier column</span></span>
<span id="cb9-10"><a href="#cb9-10" aria-hidden="true" tabindex="-1"></a>icb_id<span class="sc">$</span>dataset <span class="ot">&lt;-</span> <span class="st">'icb'</span></span>
<span id="cb9-11"><a href="#cb9-11" aria-hidden="true" tabindex="-1"></a>icb_id<span class="sc">$</span>Intervention <span class="ot">&lt;-</span> <span class="fu">as.character</span>(icb_id<span class="sc">$</span>Intervention)</span>
<span id="cb9-12"><a href="#cb9-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-13"><a href="#cb9-13" aria-hidden="true" tabindex="-1"></a><span class="co"># IMI</span></span>
<span id="cb9-14"><a href="#cb9-14" aria-hidden="true" tabindex="-1"></a><span class="do">## Subset to relevant columns</span></span>
<span id="cb9-15"><a href="#cb9-15" aria-hidden="true" tabindex="-1"></a>imi_id <span class="ot">&lt;-</span> imi[ , <span class="fu">c</span>(<span class="st">'target'</span>, <span class="st">'start'</span>, <span class="st">'description'</span>)]</span>
<span id="cb9-16"><a href="#cb9-16" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-17"><a href="#cb9-17" aria-hidden="true" tabindex="-1"></a><span class="do">## Add country name from ccode</span></span>
<span id="cb9-18"><a href="#cb9-18" aria-hidden="true" tabindex="-1"></a>imi_id<span class="sc">$</span>target <span class="ot">&lt;-</span> countrycode<span class="sc">::</span><span class="fu">countrycode</span>(imi_id<span class="sc">$</span>target, <span class="st">"cown"</span>, <span class="st">"country.name"</span>)</span>
<span id="cb9-19"><a href="#cb9-19" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-20"><a href="#cb9-20" aria-hidden="true" tabindex="-1"></a><span class="do">## Standardize column names</span></span>
<span id="cb9-21"><a href="#cb9-21" aria-hidden="true" tabindex="-1"></a>imi_id <span class="ot">&lt;-</span> imi_id <span class="sc">%&gt;%</span> dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="st">'Target'</span> <span class="ot">=</span> target,</span>
<span id="cb9-22"><a href="#cb9-22" aria-hidden="true" tabindex="-1"></a>                                   <span class="st">'Intervention'</span> <span class="ot">=</span> description,</span>
<span id="cb9-23"><a href="#cb9-23" aria-hidden="true" tabindex="-1"></a>                                   <span class="st">'Year'</span> <span class="ot">=</span> start)</span>
<span id="cb9-24"><a href="#cb9-24" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-25"><a href="#cb9-25" aria-hidden="true" tabindex="-1"></a><span class="do">## Create identifier column</span></span>
<span id="cb9-26"><a href="#cb9-26" aria-hidden="true" tabindex="-1"></a>imi_id<span class="sc">$</span>dataset <span class="ot">&lt;-</span> <span class="st">'imi'</span></span>
<span id="cb9-27"><a href="#cb9-27" aria-hidden="true" tabindex="-1"></a>imi_id<span class="sc">$</span>Intervention <span class="ot">&lt;-</span> <span class="fu">as.character</span>(imi_id<span class="sc">$</span>Intervention)</span>
<span id="cb9-28"><a href="#cb9-28" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-29"><a href="#cb9-29" aria-hidden="true" tabindex="-1"></a><span class="co"># MIPS</span></span>
<span id="cb9-30"><a href="#cb9-30" aria-hidden="true" tabindex="-1"></a><span class="do">## Subset to relevant columns</span></span>
<span id="cb9-31"><a href="#cb9-31" aria-hidden="true" tabindex="-1"></a>mips_id <span class="ot">&lt;-</span> mips[ , <span class="fu">c</span>(<span class="st">'location'</span>, <span class="st">'intervention'</span>, <span class="st">'styr'</span>)]</span>
<span id="cb9-32"><a href="#cb9-32" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-33"><a href="#cb9-33" aria-hidden="true" tabindex="-1"></a><span class="do">## Set country names so they are not numeric factors</span></span>
<span id="cb9-34"><a href="#cb9-34" aria-hidden="true" tabindex="-1"></a>mips_id<span class="sc">$</span>location <span class="ot">&lt;-</span> <span class="fu">as.character</span>(mips_id<span class="sc">$</span>location)</span>
<span id="cb9-35"><a href="#cb9-35" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-36"><a href="#cb9-36" aria-hidden="true" tabindex="-1"></a><span class="do">## Standardize column names</span></span>
<span id="cb9-37"><a href="#cb9-37" aria-hidden="true" tabindex="-1"></a>mips_id <span class="ot">&lt;-</span> mips_id <span class="sc">%&gt;%</span> dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="st">'Target'</span> <span class="ot">=</span> location,</span>
<span id="cb9-38"><a href="#cb9-38" aria-hidden="true" tabindex="-1"></a>                                   <span class="st">'Intervention'</span> <span class="ot">=</span> intervention,</span>
<span id="cb9-39"><a href="#cb9-39" aria-hidden="true" tabindex="-1"></a>                                   <span class="st">'Year'</span> <span class="ot">=</span> styr)</span>
<span id="cb9-40"><a href="#cb9-40" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-41"><a href="#cb9-41" aria-hidden="true" tabindex="-1"></a><span class="do">## Create identifier column</span></span>
<span id="cb9-42"><a href="#cb9-42" aria-hidden="true" tabindex="-1"></a>mips_id<span class="sc">$</span>dataset <span class="ot">&lt;-</span> <span class="st">'mips'</span></span>
<span id="cb9-43"><a href="#cb9-43" aria-hidden="true" tabindex="-1"></a>mips_id<span class="sc">$</span>Intervention <span class="ot">&lt;-</span> <span class="fu">as.character</span>(mips_id<span class="sc">$</span>Intervention)</span>
<span id="cb9-44"><a href="#cb9-44" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-45"><a href="#cb9-45" aria-hidden="true" tabindex="-1"></a><span class="co"># PRIO</span></span>
<span id="cb9-46"><a href="#cb9-46" aria-hidden="true" tabindex="-1"></a><span class="do">## Subset to relevant columns</span></span>
<span id="cb9-47"><a href="#cb9-47" aria-hidden="true" tabindex="-1"></a>prio_id <span class="ot">&lt;-</span> prio[ , <span class="fu">c</span>(<span class="st">'side_b'</span>, <span class="st">'year'</span>)]</span>
<span id="cb9-48"><a href="#cb9-48" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-49"><a href="#cb9-49" aria-hidden="true" tabindex="-1"></a><span class="do">## Make clear the target name is Al-Qaeda</span></span>
<span id="cb9-50"><a href="#cb9-50" aria-hidden="true" tabindex="-1"></a>prio_id<span class="sc">$</span>side_b <span class="ot">&lt;-</span> <span class="st">'Al-Qaeda'</span></span>
<span id="cb9-51"><a href="#cb9-51" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-52"><a href="#cb9-52" aria-hidden="true" tabindex="-1"></a><span class="do">## Standardize column names</span></span>
<span id="cb9-53"><a href="#cb9-53" aria-hidden="true" tabindex="-1"></a>prio_id <span class="ot">&lt;-</span> prio_id <span class="sc">%&gt;%</span> dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="st">'Target'</span> <span class="ot">=</span> side_b,</span>
<span id="cb9-54"><a href="#cb9-54" aria-hidden="true" tabindex="-1"></a>                                   <span class="st">'Year'</span> <span class="ot">=</span> year)</span>
<span id="cb9-55"><a href="#cb9-55" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-56"><a href="#cb9-56" aria-hidden="true" tabindex="-1"></a><span class="do">## Create identifier column</span></span>
<span id="cb9-57"><a href="#cb9-57" aria-hidden="true" tabindex="-1"></a>prio_id<span class="sc">$</span>dataset <span class="ot">&lt;-</span> <span class="st">'prio'</span></span>
<span id="cb9-58"><a href="#cb9-58" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-59"><a href="#cb9-59" aria-hidden="true" tabindex="-1"></a><span class="co"># MIDS</span></span>
<span id="cb9-60"><a href="#cb9-60" aria-hidden="true" tabindex="-1"></a><span class="do">## Subset to relevant columns</span></span>
<span id="cb9-61"><a href="#cb9-61" aria-hidden="true" tabindex="-1"></a>mids_id <span class="ot">&lt;-</span> mids[ , <span class="fu">c</span>(<span class="st">'dispnum3'</span>, <span class="st">'styear'</span>)]</span>
<span id="cb9-62"><a href="#cb9-62" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-63"><a href="#cb9-63" aria-hidden="true" tabindex="-1"></a><span class="do">## Standardize column names</span></span>
<span id="cb9-64"><a href="#cb9-64" aria-hidden="true" tabindex="-1"></a>mids_id <span class="ot">&lt;-</span> mids_id <span class="sc">%&gt;%</span> dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="st">'Intervention'</span> <span class="ot">=</span> dispnum3,</span>
<span id="cb9-65"><a href="#cb9-65" aria-hidden="true" tabindex="-1"></a>                                   <span class="st">'Year'</span> <span class="ot">=</span> styear)</span>
<span id="cb9-66"><a href="#cb9-66" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-67"><a href="#cb9-67" aria-hidden="true" tabindex="-1"></a><span class="do">## Create identifier column</span></span>
<span id="cb9-68"><a href="#cb9-68" aria-hidden="true" tabindex="-1"></a>mids_id<span class="sc">$</span>dataset <span class="ot">&lt;-</span> <span class="st">'mids'</span></span>
<span id="cb9-69"><a href="#cb9-69" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-70"><a href="#cb9-70" aria-hidden="true" tabindex="-1"></a><span class="co"># RAND</span></span>
<span id="cb9-71"><a href="#cb9-71" aria-hidden="true" tabindex="-1"></a><span class="do">## Subset to relevant columns</span></span>
<span id="cb9-72"><a href="#cb9-72" aria-hidden="true" tabindex="-1"></a>rand_id <span class="ot">&lt;-</span> rand[ , <span class="fu">c</span>(<span class="st">'operation_name'</span>, <span class="st">'target_country'</span>, <span class="st">'incident_start_year'</span>)]</span>
<span id="cb9-73"><a href="#cb9-73" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-74"><a href="#cb9-74" aria-hidden="true" tabindex="-1"></a><span class="do">## Standardize column names</span></span>
<span id="cb9-75"><a href="#cb9-75" aria-hidden="true" tabindex="-1"></a>rand_id <span class="ot">&lt;-</span> rand_id <span class="sc">%&gt;%</span> dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="st">'Year'</span> <span class="ot">=</span> incident_start_year,</span>
<span id="cb9-76"><a href="#cb9-76" aria-hidden="true" tabindex="-1"></a>                                   <span class="st">'Intervention'</span> <span class="ot">=</span> operation_name,</span>
<span id="cb9-77"><a href="#cb9-77" aria-hidden="true" tabindex="-1"></a>                                   <span class="st">'Target'</span> <span class="ot">=</span> target_country)</span>
<span id="cb9-78"><a href="#cb9-78" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-79"><a href="#cb9-79" aria-hidden="true" tabindex="-1"></a><span class="do">## Create identifier column</span></span>
<span id="cb9-80"><a href="#cb9-80" aria-hidden="true" tabindex="-1"></a>rand_id<span class="sc">$</span>dataset <span class="ot">&lt;-</span> <span class="st">'rand'</span></span>
<span id="cb9-81"><a href="#cb9-81" aria-hidden="true" tabindex="-1"></a>rand_id<span class="sc">$</span>Intervention <span class="ot">&lt;-</span> <span class="fu">as.character</span>(rand_id<span class="sc">$</span>Intervention)</span>
<span id="cb9-82"><a href="#cb9-82" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-83"><a href="#cb9-83" aria-hidden="true" tabindex="-1"></a><span class="co"># MIP</span></span>
<span id="cb9-84"><a href="#cb9-84" aria-hidden="true" tabindex="-1"></a><span class="do">## Subset to relevant columns</span></span>
<span id="cb9-85"><a href="#cb9-85" aria-hidden="true" tabindex="-1"></a>mip_id <span class="ot">&lt;-</span> mip <span class="sc">%&gt;%</span></span>
<span id="cb9-86"><a href="#cb9-86" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">select</span>(styear, Name, StateB)</span>
<span id="cb9-87"><a href="#cb9-87" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-88"><a href="#cb9-88" aria-hidden="true" tabindex="-1"></a><span class="do">## Standardize column names</span></span>
<span id="cb9-89"><a href="#cb9-89" aria-hidden="true" tabindex="-1"></a>mip_id <span class="ot">&lt;-</span> mip_id <span class="sc">%&gt;%</span></span>
<span id="cb9-90"><a href="#cb9-90" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="st">'Year'</span> <span class="ot">=</span> styear,</span>
<span id="cb9-91"><a href="#cb9-91" aria-hidden="true" tabindex="-1"></a>                <span class="st">'Intervention'</span> <span class="ot">=</span> Name,</span>
<span id="cb9-92"><a href="#cb9-92" aria-hidden="true" tabindex="-1"></a>                <span class="st">'Target'</span> <span class="ot">=</span> StateB)</span>
<span id="cb9-93"><a href="#cb9-93" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-94"><a href="#cb9-94" aria-hidden="true" tabindex="-1"></a>mip_id<span class="sc">$</span>dataset <span class="ot">&lt;-</span> <span class="st">'mip'</span></span>
<span id="cb9-95"><a href="#cb9-95" aria-hidden="true" tabindex="-1"></a>mip_id<span class="sc">$</span>Intervention <span class="ot">&lt;-</span> <span class="fu">as.character</span>(mip_id<span class="sc">$</span>Intervention)</span>
<span id="cb9-96"><a href="#cb9-96" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-97"><a href="#cb9-97" aria-hidden="true" tabindex="-1"></a><span class="co"># Coerce to df</span></span>
<span id="cb9-98"><a href="#cb9-98" aria-hidden="true" tabindex="-1"></a>combined_id <span class="ot">&lt;-</span> plyr<span class="sc">::</span><span class="fu">rbind.fill</span>(icb_id, imi_id, mids_id, mips_id, prio_id, rand_id, mip_id)</span>
<span id="cb9-99"><a href="#cb9-99" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-100"><a href="#cb9-100" aria-hidden="true" tabindex="-1"></a><span class="co"># Add columns to be filled by coders</span></span>
<span id="cb9-101"><a href="#cb9-101" aria-hidden="true" tabindex="-1"></a>combined_id<span class="sc">$</span>wikidata_name <span class="ot">&lt;-</span> <span class="cn">NA</span></span>
<span id="cb9-102"><a href="#cb9-102" aria-hidden="true" tabindex="-1"></a>combined_id<span class="sc">$</span>wikidata_id <span class="ot">&lt;-</span> <span class="cn">NA</span></span>
<span id="cb9-103"><a href="#cb9-103" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-104"><a href="#cb9-104" aria-hidden="true" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(combined_id)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">

<div class="datatables html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-8161123d4d7cee4f8053" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-8161123d4d7cee4f8053">{"x":{"filter":"none","vertical":false,"data":[["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69","70","71","72","73","74","75","76","77","78","79","80","81","82","83","84","85","86","87","88","89","90","91","92","93","94","95","96","97","98","99","100","101","102","103","104","105","106","107","108","109","110","111","112","113","114","115","116","117","118","119","120","121","122","123","124","125","126","127","128","129","130","131","132","133","134","135","136","137","138","139","140","141","142","143","144","145","146","147","148","149","150","151","152","153","154","155","156","157","158","159","160","161","162","163","164","165","166","167","168","169","170","171","172","173","174","175","176","177","178","179","180","181","182","183","184","185","186","187","188","189","190","191","192","193","194","195","196","197","198","199","200","201","202","203","204","205","206","207","208","209","210","211","212","213","214","215","216","217","218","219","220","221","222","223","224","225","226","227","228","229","230","231","232","233","234","235","236","237","238","239","240","241","242","243","244","245","246","247","248","249","250","251","252","253","254","255","256","257","258","259","260","261","262","263","264","265","266","267","268","269","270","271","272","273","274","275","276","277","278","279","280","281","282","283","284","285","286","287","288","289","290","291","292","293","294","295","296","297","298","299","300","301","302","303","304","305","306","307","308","309","310","311","312","313","314","315","316","317","318","319","320","321","322","323","324","325","326","327","328","329","330","331","332","333","334","335","336","337","338","339","340","341","342"],["1989","1990","1993","1994","1994","1996","1997","1998","1998","1999","2001","2003","2002","2006","2006","2009","2011","2013","2013","2015","1989","1989","1989","1990","1990","1990","1991","1992","1992","1993","1994","1994","1994","1994","1996","1996","1996","1997","1997","1997","1998","1998","1998","1998","1998","1998","2001","2001","2002","2003","2003","2004","2004","2004","2004","2005","2005","2005","1992","1992","1992","1993","1989","1989","1990","1990","1991","1991","1991","1993","1993","1993","1994","1995","1994","1999","1999","1998","1997","1997","2000","1996","1996","2000","2000","1997","1998","2000","2000","1998","1998","2000","1994","1996","1997","2001","2001","2001","2000","1993","1999","2000","2004","2008","2002","2002","2003","2003","2004","2010","2009","2010","2003","2003","2004","2004","2004","2005","2007","2007","2008","2008","2009","2002","2005","2005","2006","2007","2008","2010","1989","1989","1990","1991","1992","1993","1994","1994","1995","1996","1998","1999","1991","1992","1996","2001","2001","2002","2003","2004","2005","2006","2007","2008","2009","2010","2011","2012","2013","2014","2015","2016","2017","1991","1991","1991","1991","1991","1991","1995","1996","2004","1992","1992","1992","1992","1992","1992","1992","1992","1992","1992","1992","1992","1994","1994","1994","1994","1994","1994","1996","1998","1998","1999","1999","1999","1999","1999","1999","1999","2000","2001","2001","2001","2001","2001","2001","2002","2003","2003","2003","2004","2004","2005","2010","2010","2010","2011","2011","2011","2011","2013","2014","2014","2014","2014","2016","1989","1989","1989","1990","1990","1991","1991","1991","1991","1991","1991","1992","1992","1992","1992","1992","1993","1993","1993","1993","1993","1994","1994","1994","1995","1996","1996","1997","1997","1997","1997","1997","1998","1998","1998","1998","1998","1999","1999","1999","1999","1999","2000","2000","2000","2000","2000","2000","2000","2001","2001","2001","2002","2002","2002","2002","2002","2003","2003","2003","2003","2003","2003","2003","2004","2004","2004","2004","2004","2004","2005","2005","2005","2005","2005","2006","2006","2006","2007","2007","2008","2008","2008","2009","2009","2009","2009","2010","2010","2011","2011","2012","2012","2013","2013","2013","2014","2014","2014","2014","2015","2015","2016","2016","2017","2017","2017","2017","2017","2017","2018","2018","2018","2019","2019"],["INVASION OF PANAMA","GULF WAR","N. KOREA NUCLEAR I","HAITI MIL. REGIME","IRAQ DEPLOY./KUWAIT","DESERT STRIKE","UNSCOM I","US EMBASSY BOMBINGS","UNSCOM II","KOSOVO","AFGHANISTAN/US","IRAQ REGIME CHANGE","N. KOREA NUCLEAR II","IRAN NUCLEAR II","N. KOREA NUCLEAR III","N. KOREA NUCLEAR IV-SATELLITE LAUNCH","LIBYAN CIVILWAR","N. KOREA NUCLEAR V","SYRIA CHEMICAL WEAPONS","TURKEY-RUSSIA JET INCIDENT","U.S evacuates diplomats from Lebanon (AP, NYT)","US aids Phillippine government after coup attempt (AP, UPI, Xinh)","US removes Panamanian government (WP, NYT)","US evacuates American citizens from Liberia during civil conflict (CSM, AP, WP)","US in Saudi Arabia to protect it from Iraqi invasion in Op. Desert Shield (US Today, Des. Shield Factbook, Gulf War Chronicle)","US restores Kuwaiti government in Desert Storm (USA Today, Gulf War Chronicle)","US moves troops into Iraq from Saudi Arabia (USA Today, Factbook, Gulf War Chronicle)","U.S.troops evacuate Americans from Sierra Leone (AP, Herald)","U.S. troops give humanitarian relief to Somalia (Xinh, UP, AP) ","US planes drop food in Bosnia-Herzegovina  (TS, Xinh, UP)    ","US troops provide humanitarian assistance in Zaire (Reuters)","US provides humanitarian relief in Rwanda (UPI, WP)","US restores democratically elected government in Haiti  (UPI, AP)","US build up in Kuwait to respond to Iraqi border build-up (UPI, AP)","Operation Assured Response by US to evacuate 2444 people from Liberia (globalsecurity.org)","US evacuates nationals and protects embassy in the Central African Republic (UPI)","US buildup of troops in Kuwait after Iraq's provocation (SDUT, Reuters)","US evacuates American citizens from Albania (GNL)","US evacuates civilians from Sierra Leone (DP, Xinh)","US evacuates diplomats from Congo (BBN, TN)","US evacuates Americans from Eritrea (AP, AFP, UPI)","US gives aid to Papua-New Guinea following tidal wave disaster (FDAD, Canberra)","US Air Force delivers relief to China after devastating flood (M2, Comm)","US carries out air strikes against suspected terrorist facilities in Sudan (TNS, PI)","US uses cruise missiles to attack suspected terrorist facilities (Xinh, IP, DP)","US evacuates opposition militia member from Liberia (NYT)","US forces attack Taliban positions in Afghanistan (Global Security, TASS)","US forces patrol and provide security and act as peacekeeping force in Afghanistan (globalsecurity.org)","US evacuates foreigners in Ivory Coast (AFP, AllAfrica, CW)","US topples Iraqi government (DP, AFX, CNN)","US send peacekeepers to Liberia (Fed. Info, AFP, DP)","US aids in restoring order in Haiti (AP, AFP)","US pursues Taliban insurgents into Pakistan (AFP)","US provides tsunami relief to Thailand (AP, BBC)","US provides tsunami relief to Indonesia (FT, AFP, Scripps)","US provides tsunami relief to Sri Lanka (AFP, AP)","US troops build schools and provide medical aid in Haiti (AP, Navy Newsstand)","US troops give humanitarian aid to Pakistan after earthquake (FT, Reuters)","3550","3551","3552","3568","3900","3901","3950","3957","3972","3973","3974","4016","4021","4022","4046","4064","4065","4088","4125","4137","4174","4183","4186","4190","4196","4197","4213","4216","4217","4218","4220","4227","4254","4261","4269","4271","4273","4280","4281","4283","4298","4299","4342","4343","4371","4397","4450","4451","4455","4460","4465","4483","4486","4506","4512","4516","4518","4519","4524","4527","4535","4538","4540","4541","4543","4552","4568","4571","4575","4577","4581","4598","Operation Nimrod Dancer","Operation Just Cause","Desert Shield","Desert Storm","Operation Restore Hope (UNITAF)","Operation Continue Hope (UNOSOM)","Operation Uphold Democracy","Operation Vigilant Warrior","Operation Deliberate Force","Taiwan Strait Crisis of 1995/1996","Ops Desert Thunder/ Desert Fox","Operation Allied Force/ Noble Anvil","Ops Provide Comfort/ Northern Watch","Operation Southern Watch","Desert Strike/ Kuwait deployment","Operation Enduring Freedom-Afghanistan",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"Operation Desert Storm","Task Force Freedom","Operation Provide Comfort","Operation Northern Watch","Operation Sea Angel","Operation Safe Harbor","IFOR","SFOR","EUFOR","Operation Restore Hope","Operation Continue Hope","Operation United Shield","Operation Southern Watch ","Operation Vigilant Warrior","Operation Vigilant Sentinel","Operation Desert Strike","Operation Desert Thunder ","Operation Desert Fox ","Operation Desert Focus ","Exercise Intrinsic Action/Desert Spring","Exercise Iris Gold","Operation Sea Signal ","Operation Safe Haven ","Operation Safe Passage","Operation Support Hope","Operation Uphold Democracy ","Operation New Horizons","Operation Assured Response","Operation Infinite Reach","Operation Strong Support/Fuerte Apoyo","Plan Colombia","Operation Allied Force","Operation Noble Anvil","Operation Sustain Hope","Operation Shining Hope","Multinational Peacekeeping Force in Kosovo","Operation Avid Response","Operation Atlas Response","Operation Enduring Freedom","Operation Swift Freedom","Operation Enduring Freedom","International Security Assistance Force","Operation Freedom's Sentinel","Operation Resolute Support","Joint Task Force Horn of Africa","Operation Iraqi Freedom","Operation New Dawn","Joint Task Force Liberia","Operation Secure Tomorrow","Operation Unified Assistance","Operation Lifeline","Operation Unified Response","Flood Relief in Pakistan","Deterrence of China in Japan","Operation Odyssey Dawn","Operation Unified Protector","Operation Tomodachi","U.S. Military Support to African-Led Counter–Lord’s Resistance Army Operations","Typhoon Humanitarian Relief in the Philippines","Operation Atlantic Resolve","U.S. Military Support to African-Led Counter–Boko Haram Operations","Operation Inherent Resolve","Operation United Assistance","Anti-ISIL Air Strikes in Libya","Andean Initiative War on Drugs","Philippines Coup Attempt","Operation Just Cause","Operation Desert Shield","Operation Sharp Edge","Attack on USS La Salle","Operation Desert Storm","Operation Southern Watch, Operation Vigilant Warrior, Operation Provide Comfort/ Provide Comfort II/ Operation Northern Watch","Fishing Boats","DRC Troops Airlift","Operation Eastern Exit","NATO Intervention in Yugoslavia","Air Skirmish","Embassy Evacuation","Operation Provide Relief","Operation Restore Hope","NPT Threats","PRK Tension","NATO Intervention in Bosnia","UN Resolution 842","UNOSOM II","Operation Support Hope","Operation Uphold Democracy","Operation Support Hope","Third Taiwan Strait Crisis","Embassy Evacuation NEO","Operation Assured Response NEO","Citizen Protection Operation","Operation Silver Wake NEO","Operation Southern Watch","Evacuating U.S. citizens","Operation Nobel Obelisk NEO","Operation Infinite Reach","Evacuation (NEO)","Operation Resolute Response","Liberian Civil Wars","Operation Infinite Reach","East Timorese Crisis","Taiwan Strait Skirmishes","Korean Peninsula Hostilities","Kosovo Intervention","Vargas Tragedy","Bering Straight Probes","Russian ship carries illegal Iraqi oil","Kosovo Border","Phiblex 2000","Counterterrorism mission","UN Mission in Ethiopia and Eritrea","IMATT ","Hainan Island Incident","China/Taiwan Dispute","War in Afghanistan ","Operation Freedom Eagle; Operation Enduring Freedom - Philippines","Colombia Special Forces Deployment","Operation Enduring Freedom - Horn of Africa","U.S. Assistance to Pakistan","Evacuation Mission","Indonesia Freedom of Navigation Operation","PRK withdraws from NPT","Hood Event","Operation Iraqi Freedom ","Detention of U.S. Service members","Joint Task Force Liberia","Operation Enduring Freedom - Horn of Africa (OEF-HOA)","Fortification of Kwangju","Operation Secure Tomorrow","Iran Border Fortification","Violations of Iranian Airspace","Syria Border Clash","Operation Enduring Freedom - Horn of Africa","Counterterrorism mission/drones","Iraqi Border Clashes","Pakistan Earthquake Response","Pakistan drone strikes","Drone Strikes in Waziristan","Israel-Hezbollah War/July War","Drone strikes","Support of AMISOM","Erbil Raid","Detaining Iranian Nationals","Abu Kamal Raid","Airspace violation","Waziristan Drone Strikes","Naval Skirmish","Korean Sea Hostilities","Al-Majalah Cruise Missile Strikes","Trespassing Drone","Venezuela Airspace Violation","Border clash","Operation Odyssey Dawn","Operation Observant Compass","Philippines Typhon Relief","Hostage Rescue Mission","Syrian Civil War/Counter IS","Burundi Airlift","Operation Juniper Shield","Ukraine Military Assistance","Operation Inherent Resolve","U.S. involvement in Syrian Civil War","Operation United Assistance","Operation Freedom Sentinel","Boko Haram","Hurricane Matthew Relief ","Cruise Missile Strikes","Hurricane Maria Relief","Operation Continuing Promise","Peru Flooding Relief","Joint Task Force Hurricane Relief ","Stella Daisy Uruguay Search and Rescue Assistance","Sri Lanka Humanitarian Assistance","Thai Cave Rescue","Venezuelan Refugees Humanitarian mission","Operation Enduring Promise","Baghdad Embassy Protection","Oil tanker attacks response"],["icb","icb","icb","icb","icb","icb","icb","icb","icb","icb","icb","icb","icb","icb","icb","icb","icb","icb","icb","icb","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","imi","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mids","mips","mips","mips","mips","mips","mips","mips","mips","mips","mips","mips","mips","mips","mips","mips","mips","prio","prio","prio","prio","prio","prio","prio","prio","prio","prio","prio","prio","prio","prio","prio","prio","prio","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","rand","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip","mip"],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"Lebanon","Philippines","Panama","Liberia","Saudi Arabia","Kuwait","Iraq","Sierra Leone","Somalia","Bosnia &amp; Herzegovina","Congo - Kinshasa","Rwanda","Haiti","Kuwait","Liberia","Central African Republic","Kuwait","Albania","Sierra Leone","Congo - Brazzaville","Eritrea","Papua New Guinea","China","Sudan","Afghanistan","Liberia","Afghanistan","Afghanistan","Côte d’Ivoire","Iraq","Liberia","Haiti","Pakistan","Thailand","Indonesia","Sri Lanka","Haiti","Pakistan",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"Panama","Panama","Saudi Arabia","Kuwait","Somalia","Somalia","Haiti","Kuwait","Bosnia","Taiwan","Iraq","Yugoslavia","Iraq","Iraq","Kuwait","Afghanistan","Al-Qaeda","Al-Qaeda","Al-Qaeda","Al-Qaeda","Al-Qaeda","Al-Qaeda","Al-Qaeda","Al-Qaeda","Al-Qaeda","Al-Qaeda","Al-Qaeda","Al-Qaeda","Al-Qaeda","Al-Qaeda","Al-Qaeda","Al-Qaeda","Al-Qaeda","Iraq","Kuwait","Turkey","Iraq","Bangladesh","Cuba","Bosnia","Bosnia and Herzegovina","Bosnia and Herzegovina","Somalia","Somalia","Somalia","","","","","","","","","","","","","Rwanda","Haiti","Haiti","Liberia","","","Colombia","Kosovo","Kosovo","Kosovo","Kosovo","Kosovo","Turkey","Mozambique","","","Afghanistan","Afghanistan","Afghanistan","Afghanistan","","Iraq","Iraq","Liberia","Haiti","","Pakistan","Haiti","Pakistan","China","","","Japan","","Philippines","","","","","Libya","COL, BOL, PER","PHI","PAN","SAU","LBR","IRN","IRQ","IRQ","CAN","DRC","SOM","YUG","PER","SIE","SOM","SOM","PRK","PRK","BOS","MAC","SOM","DRC","HAI","RWA","CHN","CEN","LBR","CAM","ALB","IRN","DRC","SIE","AFG","GNB","KEN, TAZ","LBR","SUD","ETM","CHN","PRK","YUG","VEN","RUS","RUS","YUG","YUG","YEM","ERI","SIE","CHN","CHN","AFG","PHI","COL   ","DJI","PAK","CDI","INS","PRK","TUR","IRQ","IRN","LBR","ETH","PRK","HAI","IRN","IRN","SYR","KEN","YEM","SYR","PAK","PAK","PAK","LEB","PAK","SOM","IRN","IRN","SYR","PAK","PAK","CHN","PRK","YEM","IRN","VEN","PAK","LIB","UGA","PHI","SOM","JOR","CEN","NIR","UKR","IRQ, SYR","SYR","LBR","AFG","CAO","HAI","YEM","DMA","GUA, HON, COL","PER","Dominica,  St. Martin, ","URU","LKA","THI","HON","ECU","IRQ","SAU"],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]],"container":"<table class=\"display\">\n  <thead>\n    <tr>\n      <th> <\/th>\n      <th>Year<\/th>\n      <th>Intervention<\/th>\n      <th>dataset<\/th>\n      <th>Target<\/th>\n      <th>wikidata_name<\/th>\n      <th>wikidata_id<\/th>\n    <\/tr>\n  <\/thead>\n<\/table>","options":{"columnDefs":[{"orderable":false,"targets":0}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
<details>
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb10"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="fu">write.csv</span>(combined_id, <span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(), <span class="st">"/data/raw/"</span>,<span class="st">"01a_interventions_priordata_precoding.csv"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="match-to-wiki" class="level1">
<h1>Match to Wiki</h1>
<p>Now that we have standardized identifier columns across all the datasets, we can bind them into a single dataset that we then export to a googlesheet. The coders can then identify the qcodes for each event using the information provided. “01a_interventions_priordata_precoding.csv”. was loaded into a google doc called 02b_intervention_preprocess. Coders manually identified the wikidata page for each row and inputed those values into the columns wikidata_name and wikidata_id. The completed version of that googlesheet is saved in ‘./data/raw/’ as “01b_interventions_priordata_postcoding.csv”.</p>
<p>We collapse all observations that have the same wikidata ID into the same row. We are looking only at cases that are a US military intervention, defined the same as IMI (the movement of regular troops or forces (airborne, seaborne, shelling, etc) of one country inside another, in the context of some political issue or dispute).</p>
<p>We thus drop cases from prior datasets that refer to hostage extractions, humanitarian and disaster relief, military training exercises, missile tests, and events where the US military was not a participant in any kinetic activities.</p>
<div class="cell" data-hash="01_DataPrep_ExistingData_cache/html/unnamed-chunk-10_5252f71a1eb32a4a45fe19d7e1276f9b">
<details>
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb11"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a>df <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(), <span class="st">"/data/raw/"</span>,<span class="st">"01b_interventions_priordata_postcoding.csv"</span>)) <span class="sc">%&gt;%</span> </span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(drop <span class="sc">==</span> <span class="dv">0</span>) <span class="sc">%&gt;%</span></span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">select</span>(wikidata_name, wikidata_id) <span class="sc">%&gt;%</span></span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">distinct</span>()</span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(df)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">

<div class="datatables html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-61e2dda5157850c55e2b" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-61e2dda5157850c55e2b">{"x":{"filter":"none","vertical":false,"data":[["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63"],["2011 Libyan Civil War","American-led intervention in Syria","Cruise missile strikes on Iraq","Gulf War","Iraq War","Kosovo War","Operation Uphold Democracy","Operation Vigilant Warrior","United States invasion of Panama","War in Afghanistan","1989 Philippine coup attempt","2004 Haitian coup d'état","Bangui Agreements","Bosnian War","cruise missile strikes on Afghanistan and Sudan","International Security Assistance Force","Iraqi no-fly zones conflict","War on Terror","1993 cruise missile strikes on Iraq","2003 invasion of Iraq ","Cruise missile strikes on Iraq ","drone strikes in Pakistan","Iraq disarmament crisis","NATO bombing of Yugoslavia","Operation Sharp Guard","Operation Southern Watch","U.S. raid on the Iranian Liaison Office in Arbil","1999 East Timorese crisis","2008 Abu Kamal raid","African Union Mission to Somalia","Al-Maajala camp attack","Al-Qaeda insurgency in Yemen","Boko Haram insurgency","December 2019 United States airstrikes in Iraq and Syria","Gulf War air campaign","Kosovo Force",null,"NATO intervention in Bosnia and Herzegovina","Operation Enduring Freedom – Horn of Africa","Operation Enduring Freedom – Philippines","Operation Freedom's Sentinel","Operation Inherent Resolve","Operation Observant Compass","Operation Odyssey Dawn","Operation Secure Tomorrow","Rescue of Jessica Buchanan and Poul Hagen Thisted","United Nations Operation in Somalia II","Operation Desert Thunder","Operation Provide Comfort","1991 Haitian coup d'état","Bombing of Iraq","Combined Joint Task Force – Horn of Africa","First Liberian Civil War","Implementation Force","military intervention against ISIL","Operation Desert Spring","Operation Northern Watch","Operation Observant Compass","Operation Unified Protector","Operation United Shield","Operation Vigilant Sentinel","Resolute Support Mission","SFOR "],["Q81545","Q18121212","Q1781133","Q37643","Q545449","Q190029","Q2026486","Q1838811","Q459282","Q182865","Q4585384","Q2883469","Q14646592","Q181533","Q837887","Q155654","Q899657","Q185729","Q5189962","Q107802","Q1781133","Q1260080","Q1433190","Q155723","Q472398","Q2026406","Q7863480","Q152848","Q553332","Q1641888","Q4702750","Q286436","Q1569328","Q26847124","Q8256467","Q159470",null,"Q1091051","Q1195810","Q2631285","Q21296923","Q18357664","Q39207593","Q878102","Q7097528","Q7315022","Q1778229","Q3354687","Q2281470","Q4586873","Q1327861","Q3684016","Q1477500","Q313577","Q17507684","Q7096978","Q2026233","Q65066391","Q3269455","Q16250538","Q7097689","Q18651204","Q313440"]],"container":"<table class=\"display\">\n  <thead>\n    <tr>\n      <th> <\/th>\n      <th>wikidata_name<\/th>\n      <th>wikidata_id<\/th>\n    <\/tr>\n  <\/thead>\n<\/table>","options":{"columnDefs":[{"orderable":false,"targets":0}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
<details>
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb12"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="fu">write.csv</span>(df, <span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(), <span class="st">"/data/raw/"</span>,<span class="st">"01c_interventions_priordata_unique.csv"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
<p>The dataframe is now set up so that coders can identify whether each wikidata entry qualified as a US military intervention as well as what unit of analysis that intervention describes. Coders can then fill in the rest of the unit of analysis columns to populate the full universe of cases.</p>
</section>
<section id="compare-existing-datasets-to-wiki" class="level1">
<h1>Compare Existing Datasets to Wiki</h1>
<p>We want to identify the US military interventions in current political science datasets that are on wikipedia and what interventions are on wikipedia but not in current datasets.</p>
<div class="cell" data-hash="01_DataPrep_ExistingData_cache/html/unnamed-chunk-11_26291279f78a8f97e91750c342058b75">
<details>
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb13"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Loading interv list here</span></span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a>wiki <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(), <span class="st">"/data/raw/"</span>,<span class="st">"01d_interventions_newdata_list.csv"</span>))</span>
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a><span class="co"># Load and prep 01b postcoding</span></span>
<span id="cb13-5"><a href="#cb13-5" aria-hidden="true" tabindex="-1"></a>prior <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(), <span class="st">"/data/raw/"</span>,<span class="st">"01b_interventions_priordata_postcoding.csv"</span>)) <span class="sc">%&gt;%</span> </span>
<span id="cb13-6"><a href="#cb13-6" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(drop <span class="sc">==</span> <span class="dv">0</span>) <span class="sc">%&gt;%</span></span>
<span id="cb13-7"><a href="#cb13-7" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">select</span>(dataset, wikidata_name, wikidata_id)</span>
<span id="cb13-8"><a href="#cb13-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-9"><a href="#cb13-9" aria-hidden="true" tabindex="-1"></a>prior<span class="sc">$</span>dataset <span class="ot">&lt;-</span> <span class="fu">as.factor</span>(prior<span class="sc">$</span>dataset)</span>
<span id="cb13-10"><a href="#cb13-10" aria-hidden="true" tabindex="-1"></a>prior <span class="ot">&lt;-</span> fastDummies<span class="sc">::</span><span class="fu">dummy_cols</span>(prior, <span class="at">select_columns =</span> <span class="st">"dataset"</span>)</span>
<span id="cb13-11"><a href="#cb13-11" aria-hidden="true" tabindex="-1"></a>prior<span class="sc">$</span>dataset <span class="ot">&lt;-</span> <span class="cn">NULL</span></span>
<span id="cb13-12"><a href="#cb13-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-13"><a href="#cb13-13" aria-hidden="true" tabindex="-1"></a>prior <span class="ot">&lt;-</span> prior <span class="sc">%&gt;%</span></span>
<span id="cb13-14"><a href="#cb13-14" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">distinct</span>()</span>
<span id="cb13-15"><a href="#cb13-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-16"><a href="#cb13-16" aria-hidden="true" tabindex="-1"></a><span class="co"># Merge common rows</span></span>
<span id="cb13-17"><a href="#cb13-17" aria-hidden="true" tabindex="-1"></a>prior_temp <span class="ot">&lt;-</span> prior <span class="sc">%&gt;%</span></span>
<span id="cb13-18"><a href="#cb13-18" aria-hidden="true" tabindex="-1"></a>  tidyr<span class="sc">::</span><span class="fu">pivot_longer</span>(<span class="at">cols =</span> dplyr<span class="sc">::</span><span class="fu">starts_with</span>(<span class="st">"dataset_"</span>),</span>
<span id="cb13-19"><a href="#cb13-19" aria-hidden="true" tabindex="-1"></a>                      <span class="at">names_to =</span> <span class="st">"dataset"</span>,</span>
<span id="cb13-20"><a href="#cb13-20" aria-hidden="true" tabindex="-1"></a>                      <span class="at">values_to =</span> <span class="st">"contains"</span>) <span class="sc">%&gt;%</span></span>
<span id="cb13-21"><a href="#cb13-21" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(contains <span class="sc">==</span> <span class="dv">1</span>) <span class="sc">%&gt;%</span></span>
<span id="cb13-22"><a href="#cb13-22" aria-hidden="true" tabindex="-1"></a>  tidyr<span class="sc">::</span><span class="fu">pivot_wider</span>(<span class="at">id_cols =</span> dplyr<span class="sc">::</span><span class="fu">starts_with</span>(<span class="st">"wikidata_"</span>),</span>
<span id="cb13-23"><a href="#cb13-23" aria-hidden="true" tabindex="-1"></a>                     <span class="at">names_from =</span> <span class="st">"dataset"</span>,</span>
<span id="cb13-24"><a href="#cb13-24" aria-hidden="true" tabindex="-1"></a>                     <span class="at">values_from =</span> <span class="st">"contains"</span>) <span class="sc">%&gt;%</span></span>
<span id="cb13-25"><a href="#cb13-25" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate_if</span>(is.numeric, <span class="sc">~</span>tidyr<span class="sc">::</span><span class="fu">replace_na</span>(., <span class="dv">0</span>))</span>
<span id="cb13-26"><a href="#cb13-26" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-27"><a href="#cb13-27" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(plyr)</span>
<span id="cb13-28"><a href="#cb13-28" aria-hidden="true" tabindex="-1"></a>prior_temp <span class="ot">&lt;-</span> plyr<span class="sc">::</span><span class="fu">ddply</span>(prior_temp, .(wikidata_id), summarize,</span>
<span id="cb13-29"><a href="#cb13-29" aria-hidden="true" tabindex="-1"></a>                          <span class="at">wikidata_name =</span> <span class="fu">paste</span>(wikidata_name, <span class="at">collapse =</span> <span class="st">","</span>),</span>
<span id="cb13-30"><a href="#cb13-30" aria-hidden="true" tabindex="-1"></a>                          <span class="at">dataset_icb =</span> <span class="fu">paste</span>(dataset_icb, <span class="at">collapse =</span> <span class="st">","</span>),</span>
<span id="cb13-31"><a href="#cb13-31" aria-hidden="true" tabindex="-1"></a>                          <span class="at">dataset_imi =</span> <span class="fu">paste</span>(dataset_imi, <span class="at">collapse =</span> <span class="st">","</span>),</span>
<span id="cb13-32"><a href="#cb13-32" aria-hidden="true" tabindex="-1"></a>                          <span class="at">dataset_mids =</span> <span class="fu">paste</span>(dataset_mids, <span class="at">collapse =</span> <span class="st">","</span>),</span>
<span id="cb13-33"><a href="#cb13-33" aria-hidden="true" tabindex="-1"></a>                          <span class="at">dataset_mip =</span> <span class="fu">paste</span>(dataset_mip, <span class="at">collapse =</span> <span class="st">","</span>),</span>
<span id="cb13-34"><a href="#cb13-34" aria-hidden="true" tabindex="-1"></a>                          <span class="at">dataset_mips =</span> <span class="fu">paste</span>(dataset_mips, <span class="at">collapse =</span> <span class="st">","</span>),</span>
<span id="cb13-35"><a href="#cb13-35" aria-hidden="true" tabindex="-1"></a>                          <span class="at">dataset_prio =</span> <span class="fu">paste</span>(dataset_prio, <span class="at">collapse =</span> <span class="st">","</span>),</span>
<span id="cb13-36"><a href="#cb13-36" aria-hidden="true" tabindex="-1"></a>                          <span class="at">dataset_rand =</span> <span class="fu">paste</span>(dataset_rand, <span class="at">collapse =</span> <span class="st">","</span>))</span>
<span id="cb13-37"><a href="#cb13-37" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-38"><a href="#cb13-38" aria-hidden="true" tabindex="-1"></a>prior_temp <span class="ot">&lt;-</span> prior_temp <span class="sc">%&gt;%</span></span>
<span id="cb13-39"><a href="#cb13-39" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">select</span>(<span class="sc">-</span>wikidata_name)</span>
<span id="cb13-40"><a href="#cb13-40" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-41"><a href="#cb13-41" aria-hidden="true" tabindex="-1"></a><span class="do">## Format air power dataset</span></span>
<span id="cb13-42"><a href="#cb13-42" aria-hidden="true" tabindex="-1"></a>aerial_sub <span class="ot">&lt;-</span> aerial_prior[, <span class="fu">c</span>(<span class="st">"war_wikidata_name"</span>, <span class="st">"allen"</span>, <span class="st">"horowitz"</span>)] <span class="sc">%&gt;%</span></span>
<span id="cb13-43"><a href="#cb13-43" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="at">wikidata_name =</span> war_wikidata_name)</span>
<span id="cb13-44"><a href="#cb13-44" aria-hidden="true" tabindex="-1"></a>wide <span class="ot">&lt;-</span> aerial_sub</span>
<span id="cb13-45"><a href="#cb13-45" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-46"><a href="#cb13-46" aria-hidden="true" tabindex="-1"></a><span class="co">#fix coding error</span></span>
<span id="cb13-47"><a href="#cb13-47" aria-hidden="true" tabindex="-1"></a>wide<span class="sc">$</span>wikidata_name <span class="ot">&lt;-</span> <span class="fu">gsub</span>(<span class="st">"Iraqi Kurdish civil war"</span>, <span class="st">"Iraqi Kurdish Civil War"</span>, wide<span class="sc">$</span>wikidata_name)</span>
<span id="cb13-48"><a href="#cb13-48" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-49"><a href="#cb13-49" aria-hidden="true" tabindex="-1"></a>wide_fin <span class="ot">&lt;-</span> wide <span class="sc">%&gt;%</span>  </span>
<span id="cb13-50"><a href="#cb13-50" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="at">dataset_allen =</span> allen,</span>
<span id="cb13-51"><a href="#cb13-51" aria-hidden="true" tabindex="-1"></a>                <span class="at">dataset_horowitz =</span> horowitz)</span>
<span id="cb13-52"><a href="#cb13-52" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-53"><a href="#cb13-53" aria-hidden="true" tabindex="-1"></a>wide_fin<span class="sc">$</span>dataset_allen <span class="ot">&lt;-</span> <span class="fu">as.character</span>(wide_fin<span class="sc">$</span>dataset_allen)</span>
<span id="cb13-54"><a href="#cb13-54" aria-hidden="true" tabindex="-1"></a>wide_fin<span class="sc">$</span>dataset_horowitz <span class="ot">&lt;-</span> <span class="fu">as.character</span>(wide_fin<span class="sc">$</span>dataset_horowitz)</span>
<span id="cb13-55"><a href="#cb13-55" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-56"><a href="#cb13-56" aria-hidden="true" tabindex="-1"></a><span class="co"># Merge the new dummy encodings into the original list of all mil op interv on wiki</span></span>
<span id="cb13-57"><a href="#cb13-57" aria-hidden="true" tabindex="-1"></a>df <span class="ot">&lt;-</span> wiki</span>
<span id="cb13-58"><a href="#cb13-58" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-59"><a href="#cb13-59" aria-hidden="true" tabindex="-1"></a>df <span class="ot">&lt;-</span> dplyr<span class="sc">::</span><span class="fu">left_join</span>(df, prior_temp, <span class="at">by =</span> <span class="st">"wikidata_id"</span>)</span>
<span id="cb13-60"><a href="#cb13-60" aria-hidden="true" tabindex="-1"></a>df <span class="ot">&lt;-</span> dplyr<span class="sc">::</span><span class="fu">full_join</span>(df, wide_fin, <span class="at">by =</span> <span class="st">"wikidata_name"</span>)</span>
<span id="cb13-61"><a href="#cb13-61" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-62"><a href="#cb13-62" aria-hidden="true" tabindex="-1"></a><span class="co"># Visualize comparison</span></span>
<span id="cb13-63"><a href="#cb13-63" aria-hidden="true" tabindex="-1"></a>df <span class="ot">&lt;-</span> df <span class="sc">%&gt;%</span></span>
<span id="cb13-64"><a href="#cb13-64" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(<span class="sc">!</span><span class="fu">is.na</span>(wikidata_id)) <span class="sc">%&gt;%</span></span>
<span id="cb13-65"><a href="#cb13-65" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">select</span>(wikidata_name, wikidata_id, dplyr<span class="sc">::</span><span class="fu">starts_with</span>(<span class="st">"dataset_"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb13-66"><a href="#cb13-66" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">distinct</span>() <span class="sc">%&gt;%</span></span>
<span id="cb13-67"><a href="#cb13-67" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">rename_at</span>(<span class="fu">vars</span>(dplyr<span class="sc">::</span><span class="fu">starts_with</span>(<span class="st">"dataset_"</span>)),</span>
<span id="cb13-68"><a href="#cb13-68" aria-hidden="true" tabindex="-1"></a>                   dplyr<span class="sc">::</span><span class="fu">funs</span>(stringr<span class="sc">::</span><span class="fu">str_replace</span>(., <span class="st">"dataset_"</span>, <span class="st">""</span>))) <span class="sc">%&gt;%</span></span>
<span id="cb13-69"><a href="#cb13-69" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="st">'MONSTr'</span> <span class="ot">=</span> <span class="dv">1</span>) <span class="sc">%&gt;%</span></span>
<span id="cb13-70"><a href="#cb13-70" aria-hidden="true" tabindex="-1"></a>  <span class="fu">replace</span>(<span class="fu">is.na</span>(.), <span class="st">"0"</span>)</span>
<span id="cb13-71"><a href="#cb13-71" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-72"><a href="#cb13-72" aria-hidden="true" tabindex="-1"></a>df <span class="sc">%&gt;%</span></span>
<span id="cb13-73"><a href="#cb13-73" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">select</span>(<span class="sc">-</span>wikidata_name, <span class="sc">-</span>wikidata_id) <span class="sc">%&gt;%</span></span>
<span id="cb13-74"><a href="#cb13-74" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate_if</span>(is.character, as.numeric) <span class="sc">%&gt;%</span></span>
<span id="cb13-75"><a href="#cb13-75" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="at">Allen =</span> allen,</span>
<span id="cb13-76"><a href="#cb13-76" aria-hidden="true" tabindex="-1"></a>                <span class="at">Horowitz =</span> horowitz,</span>
<span id="cb13-77"><a href="#cb13-77" aria-hidden="true" tabindex="-1"></a>                <span class="at">ICB =</span> icb,</span>
<span id="cb13-78"><a href="#cb13-78" aria-hidden="true" tabindex="-1"></a>                <span class="at">MIPS =</span> mips,</span>
<span id="cb13-79"><a href="#cb13-79" aria-hidden="true" tabindex="-1"></a>                <span class="at">IMI =</span> imi,</span>
<span id="cb13-80"><a href="#cb13-80" aria-hidden="true" tabindex="-1"></a>                <span class="at">MID =</span> mids,</span>
<span id="cb13-81"><a href="#cb13-81" aria-hidden="true" tabindex="-1"></a>                <span class="at">MIP =</span> mip,</span>
<span id="cb13-82"><a href="#cb13-82" aria-hidden="true" tabindex="-1"></a>                <span class="at">RAND =</span> rand) <span class="sc">%&gt;%</span></span>
<span id="cb13-83"><a href="#cb13-83" aria-hidden="true" tabindex="-1"></a>  UpSetR<span class="sc">::</span><span class="fu">upset</span>(<span class="at">nsets =</span> <span class="dv">9</span>,</span>
<span id="cb13-84"><a href="#cb13-84" aria-hidden="true" tabindex="-1"></a>      <span class="at">number.angles =</span> <span class="dv">0</span>,</span>
<span id="cb13-85"><a href="#cb13-85" aria-hidden="true" tabindex="-1"></a>      <span class="at">point.size =</span> <span class="fl">2.5</span>,</span>
<span id="cb13-86"><a href="#cb13-86" aria-hidden="true" tabindex="-1"></a>      <span class="at">line.size =</span> <span class="dv">1</span>,</span>
<span id="cb13-87"><a href="#cb13-87" aria-hidden="true" tabindex="-1"></a>      <span class="at">text.scale =</span> <span class="fl">1.8</span>,</span>
<span id="cb13-88"><a href="#cb13-88" aria-hidden="true" tabindex="-1"></a>      <span class="at">mainbar.y.label =</span> <span class="st">"Number of Interventions"</span>,</span>
<span id="cb13-89"><a href="#cb13-89" aria-hidden="true" tabindex="-1"></a>      <span class="at">sets.x.label =</span> <span class="st">"Observations"</span>,</span>
<span id="cb13-90"><a href="#cb13-90" aria-hidden="true" tabindex="-1"></a>      <span class="at">set_size.numbers_size =</span> <span class="fl">1.2</span>,</span>
<span id="cb13-91"><a href="#cb13-91" aria-hidden="true" tabindex="-1"></a>      <span class="at">order.by =</span> <span class="st">"freq"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<p><img src="01_DataPrep_ExistingData_files/figure-html/unnamed-chunk-11-1.png" class="img-fluid" width="672"></p>
</div>
</div>
<p>Save .csv that is list of all interventions on wiki and their coverage in existing datasets</p>
<div class="cell" data-hash="01_DataPrep_ExistingData_cache/html/unnamed-chunk-12_4a6a380c5a7b7329c26c05e29b7d7e71">
<details>
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb14"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="fu">write.csv</span>(df, <span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(), <span class="st">"/data/"</span>,<span class="st">"01_interventions_newdata_comparison.csv"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
<!-- -->


</section>


<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" role="doc-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent" role="doc-bibliography">
<div id="ref-brecher_studycrisis_1997" class="csl-entry" role="doc-biblioentry">
Brecher, Michael, and Jonathan Wilkenfeld. 1997. <em>A <span>Study</span> of <span>Crisis</span></em>. <span>Ann Arbor</span>: <span>University of Michigan Press</span>.
</div>
<div id="ref-gleditsch_armedconflict19462001_2002" class="csl-entry" role="doc-biblioentry">
Gleditsch, Nils Petter, Peter Wallensteen, Mikael Eriksson, Margareta Sollenberg, and Håvard Strand. 2002. <span>“Armed <span>Conflict</span> 1946-2001: <span>A New Dataset</span>.”</span> <em>Journal of Peace Research</em> 39 (5): 615–37. <a href="https://doi.org/10.1177/0022343302039005007">https://doi.org/10.1177/0022343302039005007</a>.
</div>
<div id="ref-horowitz_whendoesaerial_2001" class="csl-entry" role="doc-biblioentry">
Horowitz, Michael, and Dan Reiter. 2001. <span>“When <span>Does Aerial Bombing Work</span>?: <span>Quantitative Empirical Tests</span>, 1917-1999.”</span> <em>The Journal of Conflict Resolution</em> 45 (2): 147–73. <a href="https://www.jstor.org/stable/3176274">https://www.jstor.org/stable/3176274</a>.
</div>
<div id="ref-kavanagh_characteristicssuccessfulmilitary_2019" class="csl-entry" role="doc-biblioentry">
Kavanagh, Jennifer, Bryan Frederick, Alexandra Stark, Nathan Chandler, Meagan Smith, Matthew Povlock, Lynn Davis, and Edward Geist. 2019. <span>“Characteristics of <span>Successful U</span>.<span>S</span>. <span>Military Interventions</span>.”</span> <span>Santa Monica, CA</span>: <span>RAND Corporation</span>. <a href="https://doi.org/10.7249/RR3062">https://doi.org/10.7249/RR3062</a>.
</div>
<div id="ref-kisangani_internationalmilitaryintervention_2008" class="csl-entry" role="doc-biblioentry">
Kisangani, Emizet F., and Jeffrey Pickering. 2008. <span>“International <span>Military Intervention</span>, 1989-2005: <span>Version</span> 1.”</span> <span>ICPSR - Interuniversity Consortium for Political and Social Research</span>. <a href="https://doi.org/10.3886/ICPSR21282.V1">https://doi.org/10.3886/ICPSR21282.V1</a>.
</div>
<div id="ref-palmer_mid4dataset2002_2015" class="csl-entry" role="doc-biblioentry">
Palmer, Glenn, Vito D’Orazio, Michael Kenwick, and Matthew Lane. 2015. <span>“The <span>Mid4</span> Dataset, 2002: <span>Procedures</span>, Coding Rules and Description.”</span> <em>Conflict Management and Peace Science</em> 32 (2): 222–42. <a href="https://doi.org/10.1177/0738894214559680">https://doi.org/10.1177/0738894214559680</a>.
</div>
<div id="ref-pape_bombingwinair_1996" class="csl-entry" role="doc-biblioentry">
Pape, Robert A. 1996. <em>Bombing to <span>Win</span>: <span>Air Power</span> and <span>Coercion</span> in <span>War</span></em>. <span>United Kingdom</span>: <span>Cornell University Press</span>.
</div>
<div id="ref-pearson_internationalmilitaryintervention_1993" class="csl-entry" role="doc-biblioentry">
Pearson, Frederic S., and Robert A. Baumann. 1993. <span>“International <span>Military Intervention</span>, 1946-1988: <span>Version</span> 1.”</span> <span>ICPSR - Interuniversity Consortium for Political and Social Research</span>. <a href="https://doi.org/10.3886/ICPSR06035.V1">https://doi.org/10.3886/ICPSR06035.V1</a>.
</div>
<div id="ref-sullivan_militaryinterventionpowerful_2009" class="csl-entry" role="doc-biblioentry">
Sullivan, Patricia L., and Michael T. Koch. 2009. <span>“Military <span>Intervention</span> by <span>Powerful States</span>, 1945.”</span> <em>Journal of Peace Research</em> 46 (5): 707–18. <a href="https://doi.org/10.1177/0022343309336796">https://doi.org/10.1177/0022343309336796</a>.
</div>
</div></section><section class="footnotes footnotes-end-of-document" role="doc-endnotes"><h2 class="anchored quarto-appendix-heading">Footnotes</h2>

<ol>
<li id="fn1" role="doc-endnote"><p>As there are 217 columns in the MIP dataset, a table summary cannot be rendered in this document.<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
</ol>
</section></div></main>
<!-- /main column -->
<script id="quarto-html-after-body" type="application/javascript">
window.document.addEventListener("DOMContentLoaded", function (event) {
  const icon = "";
  const anchorJS = new window.AnchorJS();
  anchorJS.options = {
    placement: 'right',
    icon: icon
  };
  anchorJS.add('.anchored');
  const clipboard = new window.ClipboardJS('.code-copy-button', {
    target: function(trigger) {
      return trigger.previousElementSibling;
    }
  });
  clipboard.on('success', function(e) {
    // button target
    const button = e.trigger;
    // don't keep focus
    button.blur();
    // flash "checked"
    button.classList.add('code-copy-button-checked');
    var currentTitle = button.getAttribute("title");
    button.setAttribute("title", "Copied!");
    setTimeout(function() {
      button.setAttribute("title", currentTitle);
      button.classList.remove('code-copy-button-checked');
    }, 1000);
    // clear code selection
    e.clearSelection();
  });
  const viewSource = window.document.getElementById('quarto-view-source') ||
                     window.document.getElementById('quarto-code-tools-source');
  if (viewSource) {
    const sourceUrl = viewSource.getAttribute("data-quarto-source-url");
    viewSource.addEventListener("click", function(e) {
      if (sourceUrl) {
        // rstudio viewer pane
        if (/\bcapabilities=\b/.test(window.location)) {
          window.open(sourceUrl);
        } else {
          window.location.href = sourceUrl;
        }
      } else {
        const modal = new bootstrap.Modal(document.getElementById('quarto-embedded-source-code-modal'));
        modal.show();
      }
      return false;
    });
  }
  function toggleCodeHandler(show) {
    return function(e) {
      const detailsSrc = window.document.querySelectorAll(".cell > details > .sourceCode");
      for (let i=0; i<detailsSrc.length; i++) {
        const details = detailsSrc[i].parentElement;
        if (show) {
          details.open = true;
        } else {
          details.removeAttribute("open");
        }
      }
      const cellCodeDivs = window.document.querySelectorAll(".cell > .sourceCode");
      const fromCls = show ? "hidden" : "unhidden";
      const toCls = show ? "unhidden" : "hidden";
      for (let i=0; i<cellCodeDivs.length; i++) {
        const codeDiv = cellCodeDivs[i];
        if (codeDiv.classList.contains(fromCls)) {
          codeDiv.classList.remove(fromCls);
          codeDiv.classList.add(toCls);
        } 
      }
      return false;
    }
  }
  const hideAllCode = window.document.getElementById("quarto-hide-all-code");
  if (hideAllCode) {
    hideAllCode.addEventListener("click", toggleCodeHandler(false));
  }
  const showAllCode = window.document.getElementById("quarto-show-all-code");
  if (showAllCode) {
    showAllCode.addEventListener("click", toggleCodeHandler(true));
  }
  function tippyHover(el, contentFn) {
    const config = {
      allowHTML: true,
      content: contentFn,
      maxWidth: 500,
      delay: 100,
      arrow: false,
      appendTo: function(el) {
          return el.parentElement;
      },
      interactive: true,
      interactiveBorder: 10,
      theme: 'quarto',
      placement: 'bottom-start'
    };
    window.tippy(el, config); 
  }
  const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
  for (var i=0; i<noterefs.length; i++) {
    const ref = noterefs[i];
    tippyHover(ref, function() {
      let href = ref.getAttribute('href');
      try { href = new URL(href).hash; } catch {}
      const id = href.replace(/^#\/?/, "");
      const note = window.document.getElementById(id);
      return note.innerHTML;
    });
  }
  var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
  for (var i=0; i<bibliorefs.length; i++) {
    const ref = bibliorefs[i];
    const cites = ref.parentNode.getAttribute('data-cites').split(' ');
    tippyHover(ref, function() {
      var popup = window.document.createElement('div');
      cites.forEach(function(cite) {
        var citeDiv = window.document.createElement('div');
        citeDiv.classList.add('hanging-indent');
        citeDiv.classList.add('csl-entry');
        var biblioDiv = window.document.getElementById('ref-' + cite);
        if (biblioDiv) {
          citeDiv.innerHTML = biblioDiv.innerHTML;
        }
        popup.appendChild(citeDiv);
      });
      return popup.innerHTML;
    });
  }
});
</script><div class="modal fade" id="quarto-embedded-source-code-modal" tabindex="-1" aria-labelledby="quarto-embedded-source-code-modal-label" aria-hidden="true"><div class="modal-dialog modal-dialog-scrollable"><div class="modal-content"><div class="modal-header"><h5 class="modal-title" id="quarto-embedded-source-code-modal-label">Source Code</h5><button class="btn-close" data-bs-dismiss="modal"></button></div><div class="modal-body"><div class="">
<div class="sourceCode" id="cb15" data-shortcodes="false"><pre class="sourceCode markdown code-with-copy"><code class="sourceCode markdown"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="co">---</span></span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a><span class="an">title:</span><span class="co"> '01 Data Prep - Existing Intervention Datasets'</span></span>
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true" tabindex="-1"></a><span class="an">author:</span></span>
<span id="cb15-4"><a href="#cb15-4" aria-hidden="true" tabindex="-1"></a><span class="co">  - J Andrés Gannon</span></span>
<span id="cb15-5"><a href="#cb15-5" aria-hidden="true" tabindex="-1"></a><span class="co">  - Kerry Chavez</span></span>
<span id="cb15-6"><a href="#cb15-6" aria-hidden="true" tabindex="-1"></a><span class="co">  - Cole Reynolds</span></span>
<span id="cb15-7"><a href="#cb15-7" aria-hidden="true" tabindex="-1"></a><span class="co">  - Thomas Brailey</span></span>
<span id="cb15-8"><a href="#cb15-8" aria-hidden="true" tabindex="-1"></a><span class="an">format:</span></span>
<span id="cb15-9"><a href="#cb15-9" aria-hidden="true" tabindex="-1"></a><span class="co">  html:</span></span>
<span id="cb15-10"><a href="#cb15-10" aria-hidden="true" tabindex="-1"></a><span class="co">    title-block-banner: true</span></span>
<span id="cb15-11"><a href="#cb15-11" aria-hidden="true" tabindex="-1"></a><span class="co">    toc: true</span></span>
<span id="cb15-12"><a href="#cb15-12" aria-hidden="true" tabindex="-1"></a><span class="co">    toc-location: right</span></span>
<span id="cb15-13"><a href="#cb15-13" aria-hidden="true" tabindex="-1"></a><span class="co">    toc-expand: 2</span></span>
<span id="cb15-14"><a href="#cb15-14" aria-hidden="true" tabindex="-1"></a><span class="co">    html-math-method: katex</span></span>
<span id="cb15-15"><a href="#cb15-15" aria-hidden="true" tabindex="-1"></a><span class="co">    css: styles.css</span></span>
<span id="cb15-16"><a href="#cb15-16" aria-hidden="true" tabindex="-1"></a><span class="co">    citations-hover: true</span></span>
<span id="cb15-17"><a href="#cb15-17" aria-hidden="true" tabindex="-1"></a><span class="co">    footnotes-hover: true</span></span>
<span id="cb15-18"><a href="#cb15-18" aria-hidden="true" tabindex="-1"></a><span class="co">    code-tools: true</span></span>
<span id="cb15-19"><a href="#cb15-19" aria-hidden="true" tabindex="-1"></a><span class="co">    code-fold: true</span></span>
<span id="cb15-20"><a href="#cb15-20" aria-hidden="true" tabindex="-1"></a><span class="co">    code-summary: "Show the code"</span></span>
<span id="cb15-21"><a href="#cb15-21" aria-hidden="true" tabindex="-1"></a><span class="co">    code-overflow: wrap</span></span>
<span id="cb15-22"><a href="#cb15-22" aria-hidden="true" tabindex="-1"></a><span class="co">    code-copy: true</span></span>
<span id="cb15-23"><a href="#cb15-23" aria-hidden="true" tabindex="-1"></a><span class="an">editor:</span><span class="co"> visual</span></span>
<span id="cb15-24"><a href="#cb15-24" aria-hidden="true" tabindex="-1"></a><span class="an">execute:</span></span>
<span id="cb15-25"><a href="#cb15-25" aria-hidden="true" tabindex="-1"></a><span class="co">  echo: true</span></span>
<span id="cb15-26"><a href="#cb15-26" aria-hidden="true" tabindex="-1"></a><span class="co">  warning: false</span></span>
<span id="cb15-27"><a href="#cb15-27" aria-hidden="true" tabindex="-1"></a><span class="co">  cache: true</span></span>
<span id="cb15-28"><a href="#cb15-28" aria-hidden="true" tabindex="-1"></a><span class="an">date:</span><span class="co"> "`r format(Sys.Date(), '%B %d, %Y')`"</span></span>
<span id="cb15-29"><a href="#cb15-29" aria-hidden="true" tabindex="-1"></a><span class="an">bibliography:</span><span class="co"> ../paper/MONSTr.bib</span></span>
<span id="cb15-30"><a href="#cb15-30" aria-hidden="true" tabindex="-1"></a><span class="co">---</span></span>
<span id="cb15-31"><a href="#cb15-31" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-32"><a href="#cb15-32" aria-hidden="true" tabindex="-1"></a><span class="in">```{r knitr_options, echo = FALSE, warning = FALSE, cache = FALSE}</span></span>
<span id="cb15-33"><a href="#cb15-33" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(knitr)</span>
<span id="cb15-34"><a href="#cb15-34" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(kableExtra)</span>
<span id="cb15-35"><a href="#cb15-35" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(magrittr)</span>
<span id="cb15-36"><a href="#cb15-36" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(ggplot2)</span>
<span id="cb15-37"><a href="#cb15-37" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb15-38"><a href="#cb15-38" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-39"><a href="#cb15-39" aria-hidden="true" tabindex="-1"></a>Our universe of cases is US military interventions after the Cold War.</span>
<span id="cb15-40"><a href="#cb15-40" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-41"><a href="#cb15-41" aria-hidden="true" tabindex="-1"></a><span class="fu"># Existing datasets</span></span>
<span id="cb15-42"><a href="#cb15-42" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-43"><a href="#cb15-43" aria-hidden="true" tabindex="-1"></a>We start by identifying list of US interventions coded in existing IR datasets as well as their temporal scope. We can then compare their coverage to see what covariates may conflict and where things may be missing.</span>
<span id="cb15-44"><a href="#cb15-44" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-45"><a href="#cb15-45" aria-hidden="true" tabindex="-1"></a>The first step will be loading each dataset and subsetting it to the appropriate actor (US as intervenor) and time period (post-Cold War).</span>
<span id="cb15-46"><a href="#cb15-46" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-47"><a href="#cb15-47" aria-hidden="true" tabindex="-1"></a><span class="fu">## ICB</span></span>
<span id="cb15-48"><a href="#cb15-48" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-49"><a href="#cb15-49" aria-hidden="true" tabindex="-1"></a>The International Crisis Behavior (ICB) datasets concerns international crises that may or may not have escalated to war <span class="co">[</span><span class="ot">@brecher_studycrisis_1997</span><span class="co">]</span>. We filter the dataset so that it only includes the crisis in which the United States was an actor in the post-Cold War period.</span>
<span id="cb15-50"><a href="#cb15-50" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-53"><a href="#cb15-53" aria-hidden="true" tabindex="-1"></a><span class="in">```{r}</span></span>
<span id="cb15-54"><a href="#cb15-54" aria-hidden="true" tabindex="-1"></a>icb <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(),<span class="st">"/inst/extdata/icb2v12.csv"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb15-55"><a href="#cb15-55" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(yrtrig <span class="sc">&gt;=</span> <span class="dv">1989</span> <span class="sc">&amp;</span></span>
<span id="cb15-56"><a href="#cb15-56" aria-hidden="true" tabindex="-1"></a>                  actor <span class="sc">==</span> <span class="st">"USA"</span>)</span>
<span id="cb15-57"><a href="#cb15-57" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-58"><a href="#cb15-58" aria-hidden="true" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(icb)</span>
<span id="cb15-59"><a href="#cb15-59" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb15-60"><a href="#cb15-60" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-61"><a href="#cb15-61" aria-hidden="true" tabindex="-1"></a><span class="fu">## IMI</span></span>
<span id="cb15-62"><a href="#cb15-62" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-63"><a href="#cb15-63" aria-hidden="true" tabindex="-1"></a>The IMI dataset includes international military interventions from 1946-2005 <span class="co">[</span><span class="ot">@pearson_internationalmilitaryintervention_1993, @kisangani_internationalmilitaryintervention_2008</span><span class="co">]</span>. It defines interventions as "the movement of regular troops or forces (airborne, seaborne, shelling, etc) of one country inside another, in the context of some political issue or dispute". We filter the dataset so that it only includes the crisis in which the United States was an actor in the post-Cold War period.</span>
<span id="cb15-64"><a href="#cb15-64" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-67"><a href="#cb15-67" aria-hidden="true" tabindex="-1"></a><span class="in">```{r}</span></span>
<span id="cb15-68"><a href="#cb15-68" aria-hidden="true" tabindex="-1"></a>imi <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(),<span class="st">"/inst/extdata/IMI/IMI_dataset.csv"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb15-69"><a href="#cb15-69" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(start <span class="sc">&gt;=</span> <span class="dv">19890101</span> <span class="sc">&amp;</span></span>
<span id="cb15-70"><a href="#cb15-70" aria-hidden="true" tabindex="-1"></a>                  intervener <span class="sc">==</span> <span class="dv">2</span>)</span>
<span id="cb15-71"><a href="#cb15-71" aria-hidden="true" tabindex="-1"></a>imi<span class="sc">$</span>start <span class="ot">&lt;-</span> <span class="fu">gsub</span>(<span class="st">'.{4}$'</span>, <span class="st">''</span>, imi<span class="sc">$</span>start)</span>
<span id="cb15-72"><a href="#cb15-72" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-73"><a href="#cb15-73" aria-hidden="true" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(imi)</span>
<span id="cb15-74"><a href="#cb15-74" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb15-75"><a href="#cb15-75" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-76"><a href="#cb15-76" aria-hidden="true" tabindex="-1"></a><span class="fu">## MIDs</span></span>
<span id="cb15-77"><a href="#cb15-77" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-78"><a href="#cb15-78" aria-hidden="true" tabindex="-1"></a>The MIDs dataset covers all conflicts in which a state threatens, displays, or uses force against another state from 1816-2010 <span class="co">[</span><span class="ot">@palmer_mid4dataset2002_2015</span><span class="co">]</span>. Dispute level dataset is chosen at the participant level to best identify broader disputes where the US was an actor. Disputes are inclusive of their incidents and the participant-level data allows us to subset to the US. Covariates for those disputes can later be merged from the dispute-level dataset. We filter the dataset so that it only includes the interventions in which the United States was an actor in the post-Cold War period.</span>
<span id="cb15-79"><a href="#cb15-79" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-82"><a href="#cb15-82" aria-hidden="true" tabindex="-1"></a><span class="in">```{r}</span></span>
<span id="cb15-83"><a href="#cb15-83" aria-hidden="true" tabindex="-1"></a>mids <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(),<span class="st">"/inst/extdata/MIDs/MIDs_dispute-participants.csv"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb15-84"><a href="#cb15-84" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(styear <span class="sc">&gt;=</span> <span class="dv">1989</span> <span class="sc">&amp;</span></span>
<span id="cb15-85"><a href="#cb15-85" aria-hidden="true" tabindex="-1"></a>                  ccode <span class="sc">==</span> <span class="dv">2</span>)</span>
<span id="cb15-86"><a href="#cb15-86" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-87"><a href="#cb15-87" aria-hidden="true" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(mids)</span>
<span id="cb15-88"><a href="#cb15-88" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb15-89"><a href="#cb15-89" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-90"><a href="#cb15-90" aria-hidden="true" tabindex="-1"></a><span class="fu">## MIP</span></span>
<span id="cb15-91"><a href="#cb15-91" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-94"><a href="#cb15-94" aria-hidden="true" tabindex="-1"></a><span class="in">```{r}</span></span>
<span id="cb15-95"><a href="#cb15-95" aria-hidden="true" tabindex="-1"></a>mip <span class="ot">&lt;-</span> readstata13<span class="sc">::</span><span class="fu">read.dta13</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(),<span class="st">"/inst/extdata/MIP/MIPDataKushiToft.dta"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb15-96"><a href="#cb15-96" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(styear <span class="sc">&gt;=</span> <span class="dv">1989</span> <span class="sc">&amp;</span></span>
<span id="cb15-97"><a href="#cb15-97" aria-hidden="true" tabindex="-1"></a>                  RemoveCase <span class="sc">==</span> <span class="dv">0</span>)</span>
<span id="cb15-98"><a href="#cb15-98" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb15-99"><a href="#cb15-99" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-100"><a href="#cb15-100" aria-hidden="true" tabindex="-1"></a>The MIP data also covers US military interventions, broadly defined as "united instances of international conflict or potential conflict outside of normal peacetime activities in which the purposeful threat, display, or use of military force by official US government channels is explicitly directed toward the government, official representatives, official forces, property, or territory of another state actor" <span class="co">[</span><span class="ot">@kushi_introducingmilitaryintervention_2022, 4</span><span class="co">]</span>. This is inclusive of IMI (purposeful movement of troops inside another country), CRS (armed forces abroad outside of normal peacetime purposes), RAND RUGID (at least 100 ground troops in a year), MIPS (at least 500 military personnel), and MID (military force short of war).<span class="ot">[^1]</span></span>
<span id="cb15-101"><a href="#cb15-101" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-102"><a href="#cb15-102" aria-hidden="true" tabindex="-1"></a><span class="ot">[^1]: </span>As there are <span class="in">`r ncol(mip)`</span> columns in the MIP dataset, a table summary cannot be rendered in this document.</span>
<span id="cb15-103"><a href="#cb15-103" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-104"><a href="#cb15-104" aria-hidden="true" tabindex="-1"></a><span class="fu">## MIPS</span></span>
<span id="cb15-105"><a href="#cb15-105" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-106"><a href="#cb15-106" aria-hidden="true" tabindex="-1"></a>The MIPS dataset codes Military Interventions by Powerful States from 1946-2003 <span class="co">[</span><span class="ot">@sullivan_militaryinterventionpowerful_2009</span><span class="co">]</span>. It includes the US, China, France, and Russia using force against state and non-state targets as well as their political objects, the costs of the operation, and the interventions outcomes. We filter the dataset so that it only includes the interventions in which the United States was an actor in the post-Cold War period.</span>
<span id="cb15-107"><a href="#cb15-107" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-110"><a href="#cb15-110" aria-hidden="true" tabindex="-1"></a><span class="in">```{r}</span></span>
<span id="cb15-111"><a href="#cb15-111" aria-hidden="true" tabindex="-1"></a>mips <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(),<span class="st">"/inst/extdata/MIPS/MIPS_dataset.csv"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb15-112"><a href="#cb15-112" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(styr <span class="sc">&gt;=</span> <span class="dv">1989</span> <span class="sc">&amp;</span></span>
<span id="cb15-113"><a href="#cb15-113" aria-hidden="true" tabindex="-1"></a>                  MP <span class="sc">==</span> <span class="dv">2</span>)</span>
<span id="cb15-114"><a href="#cb15-114" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-115"><a href="#cb15-115" aria-hidden="true" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(mips)</span>
<span id="cb15-116"><a href="#cb15-116" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb15-117"><a href="#cb15-117" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-118"><a href="#cb15-118" aria-hidden="true" tabindex="-1"></a><span class="fu">## PRIO</span></span>
<span id="cb15-119"><a href="#cb15-119" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-120"><a href="#cb15-120" aria-hidden="true" tabindex="-1"></a>The PRIO dataset on armed conflict includes internal and external conflicts from 1946-2008 <span class="co">[</span><span class="ot">@gleditsch_armedconflict19462001_2002</span><span class="co">]</span>. We filter the dataset so that it only includes the interventions in which the United States was an actor in the post-Cold War period.</span>
<span id="cb15-121"><a href="#cb15-121" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-124"><a href="#cb15-124" aria-hidden="true" tabindex="-1"></a><span class="in">```{r}</span></span>
<span id="cb15-125"><a href="#cb15-125" aria-hidden="true" tabindex="-1"></a>prio <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(),<span class="st">"/inst/extdata/PRIO/UCDP-PRIO_armed_conflict_dataset.csv"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb15-126"><a href="#cb15-126" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(year <span class="sc">&gt;=</span> <span class="dv">1989</span> <span class="sc">&amp;</span></span>
<span id="cb15-127"><a href="#cb15-127" aria-hidden="true" tabindex="-1"></a>                  side_a_id <span class="sc">==</span> <span class="dv">3</span>) <span class="co"># PRIO does not use the GW identifier. It is confirmed that this refers to the USA</span></span>
<span id="cb15-128"><a href="#cb15-128" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-129"><a href="#cb15-129" aria-hidden="true" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(prio)</span>
<span id="cb15-130"><a href="#cb15-130" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb15-131"><a href="#cb15-131" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-132"><a href="#cb15-132" aria-hidden="true" tabindex="-1"></a><span class="fu">## RAND</span></span>
<span id="cb15-133"><a href="#cb15-133" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-134"><a href="#cb15-134" aria-hidden="true" tabindex="-1"></a>RAND has a forthcoming dataset on US military interventions from 1898-2016 <span class="co">[</span><span class="ot">@kavanagh_characteristicssuccessfulmilitary_2019</span><span class="co">]</span>. Because the raw data is not yet public, the list of cases is taken from their appendix and copied into a dataframe. We filter the dataset so that it only includes the interventions in the post-Cold War period.</span>
<span id="cb15-135"><a href="#cb15-135" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-138"><a href="#cb15-138" aria-hidden="true" tabindex="-1"></a><span class="in">```{r}</span></span>
<span id="cb15-139"><a href="#cb15-139" aria-hidden="true" tabindex="-1"></a>rand <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(),<span class="st">"/inst/extdata/rand_interventionlist.csv"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb15-140"><a href="#cb15-140" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(incident_start_year <span class="sc">&gt;=</span> <span class="dv">1989</span>)</span>
<span id="cb15-141"><a href="#cb15-141" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-142"><a href="#cb15-142" aria-hidden="true" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(rand)</span>
<span id="cb15-143"><a href="#cb15-143" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb15-144"><a href="#cb15-144" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-145"><a href="#cb15-145" aria-hidden="true" tabindex="-1"></a><span class="fu">## Aerial bombing</span></span>
<span id="cb15-146"><a href="#cb15-146" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-147"><a href="#cb15-147" aria-hidden="true" tabindex="-1"></a>A number of other datasets on aerial bombing analyze similar conflicts and contain variables of interest. We can make our dataset compatible with those. The next task is to make them compatible by subsetting to just US aerial bombing cases and checking the unit of analysis. We'll start with @allen_understandingimpactair_2017 and @horowitz_whendoesaerial_2001.</span>
<span id="cb15-148"><a href="#cb15-148" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-149"><a href="#cb15-149" aria-hidden="true" tabindex="-1"></a>The war ID's only have a partial match to one another and not every cruise missile bombing has a COW code so we will have to make a new campaign variable for each dataset to merge the cases. Since the unique rows in our new dataset is smaller, we'll change the names in the other datasets to match the equivalents in the new cruise missile data. In this case, that will be the wikidata ID. That has the advantage of being uniform since it's an external source and can be merged using unique IDs later which will help make the data compatible with other datasets. This will allow us to then merge on the war_wikidata_name variable.</span>
<span id="cb15-150"><a href="#cb15-150" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-151"><a href="#cb15-151" aria-hidden="true" tabindex="-1"></a>While @allen_understandingimpactair_2017 has unique war names that correspond fairly closely with those in the cruise missile dataset, the other datasets do not so that will have to be manually added. Confirming that's the case, we can re-name those levels to be consistent with the corresponding column in the cruise missile data.</span>
<span id="cb15-152"><a href="#cb15-152" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-153"><a href="#cb15-153" aria-hidden="true" tabindex="-1"></a>@horowitz_whendoesaerial_2001 build on @pape_bombingwinair_1996's work to test whether air power will succeed in accomplishing foreign policy objectives by testing theories about target regime type and demand for regime change. They add more cases that represent instance of aerial bombing both after Pape's work was published and also cases he missed. Similar to @pape_bombingwinair_1996, they seek to explain success in aerial bombing and argue that when the target is militarily vulnerable, air power will succeed. The civilian vulnerability of the target does not matter. Air power works less well if the attacker demands that the target government step down and it does not matter if the target is democratic.</span>
<span id="cb15-154"><a href="#cb15-154" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-157"><a href="#cb15-157" aria-hidden="true" tabindex="-1"></a><span class="in">```{r}</span></span>
<span id="cb15-158"><a href="#cb15-158" aria-hidden="true" tabindex="-1"></a><span class="co"># Prep Allen data</span></span>
<span id="cb15-159"><a href="#cb15-159" aria-hidden="true" tabindex="-1"></a>allen_17 <span class="ot">&lt;-</span> readstata13<span class="sc">::</span><span class="fu">read.dta13</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(), <span class="st">"/inst/extdata/AllenMtzMachainAerialBombingData2016CMPS.dta"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb15-160"><a href="#cb15-160" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(year <span class="sc">&gt;=</span> <span class="dv">1989</span> <span class="sc">&amp;</span></span>
<span id="cb15-161"><a href="#cb15-161" aria-hidden="true" tabindex="-1"></a>                  ccode1 <span class="sc">==</span> <span class="dv">2</span> <span class="sc">&amp;</span></span>
<span id="cb15-162"><a href="#cb15-162" aria-hidden="true" tabindex="-1"></a>                  bomb <span class="sc">==</span> <span class="dv">1</span>) <span class="sc">%&gt;%</span></span>
<span id="cb15-163"><a href="#cb15-163" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">war_wikidata_name =</span> war) <span class="sc">%&gt;%</span></span>
<span id="cb15-164"><a href="#cb15-164" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">war_wikidata_name =</span> dplyr<span class="sc">::</span><span class="fu">recode</span>(war_wikidata_name,</span>
<span id="cb15-165"><a href="#cb15-165" aria-hidden="true" tabindex="-1"></a>                                           <span class="st">"WWI"</span> <span class="ot">=</span> <span class="st">"World War I"</span>, </span>
<span id="cb15-166"><a href="#cb15-166" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"WWII"</span> <span class="ot">=</span> <span class="st">"World War II"</span>, </span>
<span id="cb15-167"><a href="#cb15-167" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"Korean War"</span> <span class="ot">=</span> <span class="st">"Korean War"</span>, </span>
<span id="cb15-168"><a href="#cb15-168" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"Vietnam Phase 2"</span> <span class="ot">=</span> <span class="st">"Vietnam War"</span>,</span>
<span id="cb15-169"><a href="#cb15-169" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"Vietnam (163)"</span> <span class="ot">=</span> <span class="st">"Vietnam War"</span>,</span>
<span id="cb15-170"><a href="#cb15-170" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"Vietnam"</span> <span class="ot">=</span> <span class="st">"Vietnam War"</span>,</span>
<span id="cb15-171"><a href="#cb15-171" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"Vietnam Phase2"</span> <span class="ot">=</span> <span class="st">"Vietnam War"</span>, </span>
<span id="cb15-172"><a href="#cb15-172" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"Second Laotian (170)"</span> <span class="ot">=</span> <span class="st">"Laotian Civil War"</span>,</span>
<span id="cb15-173"><a href="#cb15-173" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"2nd Laotian War, ph 2"</span> <span class="ot">=</span> <span class="st">"Laotian Civil War"</span>,</span>
<span id="cb15-174"><a href="#cb15-174" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"Gulf War"</span> <span class="ot">=</span> <span class="st">"Gulf War"</span>,</span>
<span id="cb15-175"><a href="#cb15-175" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"War for Kosovo"</span> <span class="ot">=</span> <span class="st">"Kosovo War"</span>,</span>
<span id="cb15-176"><a href="#cb15-176" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"Invasion of Afghanistan"</span> <span class="ot">=</span> <span class="st">"War in Afghanistan"</span>,</span>
<span id="cb15-177"><a href="#cb15-177" aria-hidden="true" tabindex="-1"></a>                                            <span class="st">"Invasion of Iraq"</span> <span class="ot">=</span> <span class="st">"Iraq War"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb15-178"><a href="#cb15-178" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">allen =</span> <span class="dv">1</span>)</span>
<span id="cb15-179"><a href="#cb15-179" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-180"><a href="#cb15-180" aria-hidden="true" tabindex="-1"></a><span class="co"># Prep Horowitz data</span></span>
<span id="cb15-181"><a href="#cb15-181" aria-hidden="true" tabindex="-1"></a>horowitz_01 <span class="ot">&lt;-</span> foreign<span class="sc">::</span><span class="fu">read.dta</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(), <span class="st">"/inst/extdata/jcr01.dta"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb15-182"><a href="#cb15-182" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(attacker <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">'United States'</span>, <span class="st">'Allies'</span>, <span class="st">'U.S./Britain'</span>, <span class="st">'NATO'</span>, <span class="st">'US'</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb15-183"><a href="#cb15-183" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">date =</span> dplyr<span class="sc">::</span><span class="fu">recode</span>(date,</span>
<span id="cb15-184"><a href="#cb15-184" aria-hidden="true" tabindex="-1"></a>                                     <span class="st">'1944-1945'</span> <span class="ot">=</span> <span class="st">"1944"</span>,</span>
<span id="cb15-185"><a href="#cb15-185" aria-hidden="true" tabindex="-1"></a>                                     <span class="st">'1942-1944'</span> <span class="ot">=</span> <span class="st">"1942"</span>,</span>
<span id="cb15-186"><a href="#cb15-186" aria-hidden="true" tabindex="-1"></a>                                     <span class="st">'Aug. 1945'</span> <span class="ot">=</span> <span class="st">"1945"</span>,</span>
<span id="cb15-187"><a href="#cb15-187" aria-hidden="true" tabindex="-1"></a>                                     <span class="st">'1965-1968'</span> <span class="ot">=</span> <span class="st">"1965"</span>,</span>
<span id="cb15-188"><a href="#cb15-188" aria-hidden="true" tabindex="-1"></a>                                     <span class="st">'1950-1951'</span> <span class="ot">=</span> <span class="st">"1950"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb15-189"><a href="#cb15-189" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">date =</span> <span class="fu">as.numeric</span>(date)) <span class="sc">%&gt;%</span></span>
<span id="cb15-190"><a href="#cb15-190" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(date <span class="sc">&gt;=</span> <span class="dv">1989</span>) <span class="sc">%&gt;%</span></span>
<span id="cb15-191"><a href="#cb15-191" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">war_wikidata_name =</span> warid) <span class="sc">%&gt;%</span></span>
<span id="cb15-192"><a href="#cb15-192" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">war_wikidata_name =</span> <span class="fu">ifelse</span>(date <span class="sc">==</span> <span class="st">"1991"</span>, <span class="st">"Gulf War"</span>, war_wikidata_name),</span>
<span id="cb15-193"><a href="#cb15-193" aria-hidden="true" tabindex="-1"></a>                <span class="at">war_wikidata_name =</span> <span class="fu">ifelse</span>(date <span class="sc">==</span> <span class="st">"1996"</span>, <span class="st">"Iraqi Kurdish Civil War"</span>, war_wikidata_name),</span>
<span id="cb15-194"><a href="#cb15-194" aria-hidden="true" tabindex="-1"></a>                <span class="at">war_wikidata_name =</span> <span class="fu">ifelse</span>(date <span class="sc">==</span> <span class="st">"1998"</span>, <span class="st">"Iraqi no-fly zones"</span>, war_wikidata_name)) <span class="sc">%&gt;%</span></span>
<span id="cb15-195"><a href="#cb15-195" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">horowitz =</span> <span class="dv">1</span>)</span>
<span id="cb15-196"><a href="#cb15-196" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-197"><a href="#cb15-197" aria-hidden="true" tabindex="-1"></a><span class="co"># Merge together</span></span>
<span id="cb15-198"><a href="#cb15-198" aria-hidden="true" tabindex="-1"></a>aerial_prior <span class="ot">&lt;-</span> dplyr<span class="sc">::</span><span class="fu">full_join</span>(allen_17, horowitz_01) <span class="sc">%&gt;%</span></span>
<span id="cb15-199"><a href="#cb15-199" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">allen =</span> <span class="fu">ifelse</span>(<span class="fu">is.na</span>(allen), <span class="dv">0</span>, <span class="dv">1</span>),</span>
<span id="cb15-200"><a href="#cb15-200" aria-hidden="true" tabindex="-1"></a>                <span class="at">horowitz =</span> <span class="fu">ifelse</span>(<span class="fu">is.na</span>(horowitz), <span class="dv">0</span>, <span class="dv">1</span>))</span>
<span id="cb15-201"><a href="#cb15-201" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-202"><a href="#cb15-202" aria-hidden="true" tabindex="-1"></a><span class="do">### AG pick up here by adding more mods to the aerial prior in the above section</span></span>
<span id="cb15-203"><a href="#cb15-203" aria-hidden="true" tabindex="-1"></a><span class="do">### Attacker ccode</span></span>
<span id="cb15-204"><a href="#cb15-204" aria-hidden="true" tabindex="-1"></a>aerial_prior<span class="sc">$</span>ccode1 <span class="ot">&lt;-</span> <span class="dv">2</span></span>
<span id="cb15-205"><a href="#cb15-205" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-206"><a href="#cb15-206" aria-hidden="true" tabindex="-1"></a><span class="do">### Defender ccode</span></span>
<span id="cb15-207"><a href="#cb15-207" aria-hidden="true" tabindex="-1"></a>aerial_prior<span class="sc">$</span>ccode2_merge <span class="ot">&lt;-</span> countrycode<span class="sc">::</span><span class="fu">countrycode</span>(aerial_prior<span class="sc">$</span>defender, <span class="st">"country.name"</span>, <span class="st">"cown"</span>)</span>
<span id="cb15-208"><a href="#cb15-208" aria-hidden="true" tabindex="-1"></a>aerial_prior<span class="sc">$</span>ccode2 <span class="ot">&lt;-</span> <span class="fu">ifelse</span>(<span class="fu">is.na</span>(aerial_prior<span class="sc">$</span>ccode2), aerial_prior<span class="sc">$</span>ccode2_merge, aerial_prior<span class="sc">$</span>ccode2)</span>
<span id="cb15-209"><a href="#cb15-209" aria-hidden="true" tabindex="-1"></a>aerial_prior<span class="sc">$</span>ccode2_merge <span class="ot">&lt;-</span> <span class="cn">NULL</span></span>
<span id="cb15-210"><a href="#cb15-210" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-211"><a href="#cb15-211" aria-hidden="true" tabindex="-1"></a><span class="do">### Defender name</span></span>
<span id="cb15-212"><a href="#cb15-212" aria-hidden="true" tabindex="-1"></a>aerial_prior<span class="sc">$</span>defender2_merge <span class="ot">&lt;-</span> countrycode<span class="sc">::</span><span class="fu">countrycode</span>(aerial_prior<span class="sc">$</span>ccode2, <span class="st">"cown"</span>, <span class="st">"country.name"</span>)</span>
<span id="cb15-213"><a href="#cb15-213" aria-hidden="true" tabindex="-1"></a>aerial_prior<span class="sc">$</span>defender2 <span class="ot">&lt;-</span> <span class="fu">ifelse</span>(<span class="fu">is.na</span>(aerial_prior<span class="sc">$</span>defender2), aerial_prior<span class="sc">$</span>defender2_merge, aerial_prior<span class="sc">$</span>defender2)</span>
<span id="cb15-214"><a href="#cb15-214" aria-hidden="true" tabindex="-1"></a>aerial_prior<span class="sc">$</span>defender2_merge <span class="ot">&lt;-</span> <span class="cn">NULL</span></span>
<span id="cb15-215"><a href="#cb15-215" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-216"><a href="#cb15-216" aria-hidden="true" tabindex="-1"></a>aerial_prior <span class="sc">%&gt;%</span></span>
<span id="cb15-217"><a href="#cb15-217" aria-hidden="true" tabindex="-1"></a>  DT<span class="sc">::</span><span class="fu">datatable</span>()</span>
<span id="cb15-218"><a href="#cb15-218" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb15-219"><a href="#cb15-219" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-220"><a href="#cb15-220" aria-hidden="true" tabindex="-1"></a><span class="fu"># Merge</span></span>
<span id="cb15-221"><a href="#cb15-221" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-222"><a href="#cb15-222" aria-hidden="true" tabindex="-1"></a>Now that we know the interventions each dataset identifies for the US post-1989, we can compare them and see what cases each one covers. Then we merge those cases to get a non-duplicated list of interventions for which we want to identify the campaigns and operations. Each dataset should have each US intervention as a unique row.</span>
<span id="cb15-223"><a href="#cb15-223" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-224"><a href="#cb15-224" aria-hidden="true" tabindex="-1"></a>Rather than trying to manually merge each dataset to one another, the easiest method will be merging each observation from each dataset to the Q code for that event. Then we see which Q codes match up</span>
<span id="cb15-225"><a href="#cb15-225" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-226"><a href="#cb15-226" aria-hidden="true" tabindex="-1"></a>We subset to only variables useful for Q code identification To help coders identify the ccode for each observation, we'll want the name provided by the dataset, target country, and date.</span>
<span id="cb15-227"><a href="#cb15-227" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-230"><a href="#cb15-230" aria-hidden="true" tabindex="-1"></a><span class="in">```{r}</span></span>
<span id="cb15-231"><a href="#cb15-231" aria-hidden="true" tabindex="-1"></a><span class="co"># ICB</span></span>
<span id="cb15-232"><a href="#cb15-232" aria-hidden="true" tabindex="-1"></a><span class="do">## Subset to relevant columns</span></span>
<span id="cb15-233"><a href="#cb15-233" aria-hidden="true" tabindex="-1"></a>icb_id <span class="ot">&lt;-</span> icb[ , <span class="fu">c</span>(<span class="st">'yrtrig'</span>, <span class="st">'crisname'</span>)]</span>
<span id="cb15-234"><a href="#cb15-234" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-235"><a href="#cb15-235" aria-hidden="true" tabindex="-1"></a><span class="do">## Standardize column names</span></span>
<span id="cb15-236"><a href="#cb15-236" aria-hidden="true" tabindex="-1"></a>icb_id <span class="ot">&lt;-</span> icb_id <span class="sc">%&gt;%</span> dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="st">'Year'</span> <span class="ot">=</span> yrtrig,</span>
<span id="cb15-237"><a href="#cb15-237" aria-hidden="true" tabindex="-1"></a>                                   <span class="st">'Intervention'</span> <span class="ot">=</span> crisname)</span>
<span id="cb15-238"><a href="#cb15-238" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-239"><a href="#cb15-239" aria-hidden="true" tabindex="-1"></a><span class="do">## Create identifier column</span></span>
<span id="cb15-240"><a href="#cb15-240" aria-hidden="true" tabindex="-1"></a>icb_id<span class="sc">$</span>dataset <span class="ot">&lt;-</span> <span class="st">'icb'</span></span>
<span id="cb15-241"><a href="#cb15-241" aria-hidden="true" tabindex="-1"></a>icb_id<span class="sc">$</span>Intervention <span class="ot">&lt;-</span> <span class="fu">as.character</span>(icb_id<span class="sc">$</span>Intervention)</span>
<span id="cb15-242"><a href="#cb15-242" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-243"><a href="#cb15-243" aria-hidden="true" tabindex="-1"></a><span class="co"># IMI</span></span>
<span id="cb15-244"><a href="#cb15-244" aria-hidden="true" tabindex="-1"></a><span class="do">## Subset to relevant columns</span></span>
<span id="cb15-245"><a href="#cb15-245" aria-hidden="true" tabindex="-1"></a>imi_id <span class="ot">&lt;-</span> imi[ , <span class="fu">c</span>(<span class="st">'target'</span>, <span class="st">'start'</span>, <span class="st">'description'</span>)]</span>
<span id="cb15-246"><a href="#cb15-246" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-247"><a href="#cb15-247" aria-hidden="true" tabindex="-1"></a><span class="do">## Add country name from ccode</span></span>
<span id="cb15-248"><a href="#cb15-248" aria-hidden="true" tabindex="-1"></a>imi_id<span class="sc">$</span>target <span class="ot">&lt;-</span> countrycode<span class="sc">::</span><span class="fu">countrycode</span>(imi_id<span class="sc">$</span>target, <span class="st">"cown"</span>, <span class="st">"country.name"</span>)</span>
<span id="cb15-249"><a href="#cb15-249" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-250"><a href="#cb15-250" aria-hidden="true" tabindex="-1"></a><span class="do">## Standardize column names</span></span>
<span id="cb15-251"><a href="#cb15-251" aria-hidden="true" tabindex="-1"></a>imi_id <span class="ot">&lt;-</span> imi_id <span class="sc">%&gt;%</span> dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="st">'Target'</span> <span class="ot">=</span> target,</span>
<span id="cb15-252"><a href="#cb15-252" aria-hidden="true" tabindex="-1"></a>                                   <span class="st">'Intervention'</span> <span class="ot">=</span> description,</span>
<span id="cb15-253"><a href="#cb15-253" aria-hidden="true" tabindex="-1"></a>                                   <span class="st">'Year'</span> <span class="ot">=</span> start)</span>
<span id="cb15-254"><a href="#cb15-254" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-255"><a href="#cb15-255" aria-hidden="true" tabindex="-1"></a><span class="do">## Create identifier column</span></span>
<span id="cb15-256"><a href="#cb15-256" aria-hidden="true" tabindex="-1"></a>imi_id<span class="sc">$</span>dataset <span class="ot">&lt;-</span> <span class="st">'imi'</span></span>
<span id="cb15-257"><a href="#cb15-257" aria-hidden="true" tabindex="-1"></a>imi_id<span class="sc">$</span>Intervention <span class="ot">&lt;-</span> <span class="fu">as.character</span>(imi_id<span class="sc">$</span>Intervention)</span>
<span id="cb15-258"><a href="#cb15-258" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-259"><a href="#cb15-259" aria-hidden="true" tabindex="-1"></a><span class="co"># MIPS</span></span>
<span id="cb15-260"><a href="#cb15-260" aria-hidden="true" tabindex="-1"></a><span class="do">## Subset to relevant columns</span></span>
<span id="cb15-261"><a href="#cb15-261" aria-hidden="true" tabindex="-1"></a>mips_id <span class="ot">&lt;-</span> mips[ , <span class="fu">c</span>(<span class="st">'location'</span>, <span class="st">'intervention'</span>, <span class="st">'styr'</span>)]</span>
<span id="cb15-262"><a href="#cb15-262" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-263"><a href="#cb15-263" aria-hidden="true" tabindex="-1"></a><span class="do">## Set country names so they are not numeric factors</span></span>
<span id="cb15-264"><a href="#cb15-264" aria-hidden="true" tabindex="-1"></a>mips_id<span class="sc">$</span>location <span class="ot">&lt;-</span> <span class="fu">as.character</span>(mips_id<span class="sc">$</span>location)</span>
<span id="cb15-265"><a href="#cb15-265" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-266"><a href="#cb15-266" aria-hidden="true" tabindex="-1"></a><span class="do">## Standardize column names</span></span>
<span id="cb15-267"><a href="#cb15-267" aria-hidden="true" tabindex="-1"></a>mips_id <span class="ot">&lt;-</span> mips_id <span class="sc">%&gt;%</span> dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="st">'Target'</span> <span class="ot">=</span> location,</span>
<span id="cb15-268"><a href="#cb15-268" aria-hidden="true" tabindex="-1"></a>                                   <span class="st">'Intervention'</span> <span class="ot">=</span> intervention,</span>
<span id="cb15-269"><a href="#cb15-269" aria-hidden="true" tabindex="-1"></a>                                   <span class="st">'Year'</span> <span class="ot">=</span> styr)</span>
<span id="cb15-270"><a href="#cb15-270" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-271"><a href="#cb15-271" aria-hidden="true" tabindex="-1"></a><span class="do">## Create identifier column</span></span>
<span id="cb15-272"><a href="#cb15-272" aria-hidden="true" tabindex="-1"></a>mips_id<span class="sc">$</span>dataset <span class="ot">&lt;-</span> <span class="st">'mips'</span></span>
<span id="cb15-273"><a href="#cb15-273" aria-hidden="true" tabindex="-1"></a>mips_id<span class="sc">$</span>Intervention <span class="ot">&lt;-</span> <span class="fu">as.character</span>(mips_id<span class="sc">$</span>Intervention)</span>
<span id="cb15-274"><a href="#cb15-274" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-275"><a href="#cb15-275" aria-hidden="true" tabindex="-1"></a><span class="co"># PRIO</span></span>
<span id="cb15-276"><a href="#cb15-276" aria-hidden="true" tabindex="-1"></a><span class="do">## Subset to relevant columns</span></span>
<span id="cb15-277"><a href="#cb15-277" aria-hidden="true" tabindex="-1"></a>prio_id <span class="ot">&lt;-</span> prio[ , <span class="fu">c</span>(<span class="st">'side_b'</span>, <span class="st">'year'</span>)]</span>
<span id="cb15-278"><a href="#cb15-278" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-279"><a href="#cb15-279" aria-hidden="true" tabindex="-1"></a><span class="do">## Make clear the target name is Al-Qaeda</span></span>
<span id="cb15-280"><a href="#cb15-280" aria-hidden="true" tabindex="-1"></a>prio_id<span class="sc">$</span>side_b <span class="ot">&lt;-</span> <span class="st">'Al-Qaeda'</span></span>
<span id="cb15-281"><a href="#cb15-281" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-282"><a href="#cb15-282" aria-hidden="true" tabindex="-1"></a><span class="do">## Standardize column names</span></span>
<span id="cb15-283"><a href="#cb15-283" aria-hidden="true" tabindex="-1"></a>prio_id <span class="ot">&lt;-</span> prio_id <span class="sc">%&gt;%</span> dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="st">'Target'</span> <span class="ot">=</span> side_b,</span>
<span id="cb15-284"><a href="#cb15-284" aria-hidden="true" tabindex="-1"></a>                                   <span class="st">'Year'</span> <span class="ot">=</span> year)</span>
<span id="cb15-285"><a href="#cb15-285" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-286"><a href="#cb15-286" aria-hidden="true" tabindex="-1"></a><span class="do">## Create identifier column</span></span>
<span id="cb15-287"><a href="#cb15-287" aria-hidden="true" tabindex="-1"></a>prio_id<span class="sc">$</span>dataset <span class="ot">&lt;-</span> <span class="st">'prio'</span></span>
<span id="cb15-288"><a href="#cb15-288" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-289"><a href="#cb15-289" aria-hidden="true" tabindex="-1"></a><span class="co"># MIDS</span></span>
<span id="cb15-290"><a href="#cb15-290" aria-hidden="true" tabindex="-1"></a><span class="do">## Subset to relevant columns</span></span>
<span id="cb15-291"><a href="#cb15-291" aria-hidden="true" tabindex="-1"></a>mids_id <span class="ot">&lt;-</span> mids[ , <span class="fu">c</span>(<span class="st">'dispnum3'</span>, <span class="st">'styear'</span>)]</span>
<span id="cb15-292"><a href="#cb15-292" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-293"><a href="#cb15-293" aria-hidden="true" tabindex="-1"></a><span class="do">## Standardize column names</span></span>
<span id="cb15-294"><a href="#cb15-294" aria-hidden="true" tabindex="-1"></a>mids_id <span class="ot">&lt;-</span> mids_id <span class="sc">%&gt;%</span> dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="st">'Intervention'</span> <span class="ot">=</span> dispnum3,</span>
<span id="cb15-295"><a href="#cb15-295" aria-hidden="true" tabindex="-1"></a>                                   <span class="st">'Year'</span> <span class="ot">=</span> styear)</span>
<span id="cb15-296"><a href="#cb15-296" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-297"><a href="#cb15-297" aria-hidden="true" tabindex="-1"></a><span class="do">## Create identifier column</span></span>
<span id="cb15-298"><a href="#cb15-298" aria-hidden="true" tabindex="-1"></a>mids_id<span class="sc">$</span>dataset <span class="ot">&lt;-</span> <span class="st">'mids'</span></span>
<span id="cb15-299"><a href="#cb15-299" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-300"><a href="#cb15-300" aria-hidden="true" tabindex="-1"></a><span class="co"># RAND</span></span>
<span id="cb15-301"><a href="#cb15-301" aria-hidden="true" tabindex="-1"></a><span class="do">## Subset to relevant columns</span></span>
<span id="cb15-302"><a href="#cb15-302" aria-hidden="true" tabindex="-1"></a>rand_id <span class="ot">&lt;-</span> rand[ , <span class="fu">c</span>(<span class="st">'operation_name'</span>, <span class="st">'target_country'</span>, <span class="st">'incident_start_year'</span>)]</span>
<span id="cb15-303"><a href="#cb15-303" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-304"><a href="#cb15-304" aria-hidden="true" tabindex="-1"></a><span class="do">## Standardize column names</span></span>
<span id="cb15-305"><a href="#cb15-305" aria-hidden="true" tabindex="-1"></a>rand_id <span class="ot">&lt;-</span> rand_id <span class="sc">%&gt;%</span> dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="st">'Year'</span> <span class="ot">=</span> incident_start_year,</span>
<span id="cb15-306"><a href="#cb15-306" aria-hidden="true" tabindex="-1"></a>                                   <span class="st">'Intervention'</span> <span class="ot">=</span> operation_name,</span>
<span id="cb15-307"><a href="#cb15-307" aria-hidden="true" tabindex="-1"></a>                                   <span class="st">'Target'</span> <span class="ot">=</span> target_country)</span>
<span id="cb15-308"><a href="#cb15-308" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-309"><a href="#cb15-309" aria-hidden="true" tabindex="-1"></a><span class="do">## Create identifier column</span></span>
<span id="cb15-310"><a href="#cb15-310" aria-hidden="true" tabindex="-1"></a>rand_id<span class="sc">$</span>dataset <span class="ot">&lt;-</span> <span class="st">'rand'</span></span>
<span id="cb15-311"><a href="#cb15-311" aria-hidden="true" tabindex="-1"></a>rand_id<span class="sc">$</span>Intervention <span class="ot">&lt;-</span> <span class="fu">as.character</span>(rand_id<span class="sc">$</span>Intervention)</span>
<span id="cb15-312"><a href="#cb15-312" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-313"><a href="#cb15-313" aria-hidden="true" tabindex="-1"></a><span class="co"># MIP</span></span>
<span id="cb15-314"><a href="#cb15-314" aria-hidden="true" tabindex="-1"></a><span class="do">## Subset to relevant columns</span></span>
<span id="cb15-315"><a href="#cb15-315" aria-hidden="true" tabindex="-1"></a>mip_id <span class="ot">&lt;-</span> mip <span class="sc">%&gt;%</span></span>
<span id="cb15-316"><a href="#cb15-316" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">select</span>(styear, Name, StateB)</span>
<span id="cb15-317"><a href="#cb15-317" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-318"><a href="#cb15-318" aria-hidden="true" tabindex="-1"></a><span class="do">## Standardize column names</span></span>
<span id="cb15-319"><a href="#cb15-319" aria-hidden="true" tabindex="-1"></a>mip_id <span class="ot">&lt;-</span> mip_id <span class="sc">%&gt;%</span></span>
<span id="cb15-320"><a href="#cb15-320" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="st">'Year'</span> <span class="ot">=</span> styear,</span>
<span id="cb15-321"><a href="#cb15-321" aria-hidden="true" tabindex="-1"></a>                <span class="st">'Intervention'</span> <span class="ot">=</span> Name,</span>
<span id="cb15-322"><a href="#cb15-322" aria-hidden="true" tabindex="-1"></a>                <span class="st">'Target'</span> <span class="ot">=</span> StateB)</span>
<span id="cb15-323"><a href="#cb15-323" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-324"><a href="#cb15-324" aria-hidden="true" tabindex="-1"></a>mip_id<span class="sc">$</span>dataset <span class="ot">&lt;-</span> <span class="st">'mip'</span></span>
<span id="cb15-325"><a href="#cb15-325" aria-hidden="true" tabindex="-1"></a>mip_id<span class="sc">$</span>Intervention <span class="ot">&lt;-</span> <span class="fu">as.character</span>(mip_id<span class="sc">$</span>Intervention)</span>
<span id="cb15-326"><a href="#cb15-326" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-327"><a href="#cb15-327" aria-hidden="true" tabindex="-1"></a><span class="co"># Coerce to df</span></span>
<span id="cb15-328"><a href="#cb15-328" aria-hidden="true" tabindex="-1"></a>combined_id <span class="ot">&lt;-</span> plyr<span class="sc">::</span><span class="fu">rbind.fill</span>(icb_id, imi_id, mids_id, mips_id, prio_id, rand_id, mip_id)</span>
<span id="cb15-329"><a href="#cb15-329" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-330"><a href="#cb15-330" aria-hidden="true" tabindex="-1"></a><span class="co"># Add columns to be filled by coders</span></span>
<span id="cb15-331"><a href="#cb15-331" aria-hidden="true" tabindex="-1"></a>combined_id<span class="sc">$</span>wikidata_name <span class="ot">&lt;-</span> <span class="cn">NA</span></span>
<span id="cb15-332"><a href="#cb15-332" aria-hidden="true" tabindex="-1"></a>combined_id<span class="sc">$</span>wikidata_id <span class="ot">&lt;-</span> <span class="cn">NA</span></span>
<span id="cb15-333"><a href="#cb15-333" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-334"><a href="#cb15-334" aria-hidden="true" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(combined_id)</span>
<span id="cb15-335"><a href="#cb15-335" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-336"><a href="#cb15-336" aria-hidden="true" tabindex="-1"></a><span class="fu">write.csv</span>(combined_id, <span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(), <span class="st">"/data/raw/"</span>,<span class="st">"01a_interventions_priordata_precoding.csv"</span>))</span>
<span id="cb15-337"><a href="#cb15-337" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb15-338"><a href="#cb15-338" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-339"><a href="#cb15-339" aria-hidden="true" tabindex="-1"></a><span class="fu"># Match to Wiki</span></span>
<span id="cb15-340"><a href="#cb15-340" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-341"><a href="#cb15-341" aria-hidden="true" tabindex="-1"></a>Now that we have standardized identifier columns across all the datasets, we can bind them into a single dataset that we then export to a googlesheet. The coders can then identify the qcodes for each event using the information provided. "01a_interventions_priordata_precoding.csv". was loaded into a google doc called 02b_intervention_preprocess. Coders manually identified the wikidata page for each row and inputed those values into the columns wikidata_name and wikidata_id. The completed version of that googlesheet is saved in './data/raw/' as "01b_interventions_priordata_postcoding.csv".</span>
<span id="cb15-342"><a href="#cb15-342" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-343"><a href="#cb15-343" aria-hidden="true" tabindex="-1"></a>We collapse all observations that have the same wikidata ID into the same row. We are looking only at cases that are a US military intervention, defined the same as IMI (the movement of regular troops or forces (airborne, seaborne, shelling, etc) of one country inside another, in the context of some political issue or dispute).</span>
<span id="cb15-344"><a href="#cb15-344" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-345"><a href="#cb15-345" aria-hidden="true" tabindex="-1"></a>We thus drop cases from prior datasets that refer to hostage extractions, humanitarian and disaster relief, military training exercises, missile tests, and events where the US military was not a participant in any kinetic activities.</span>
<span id="cb15-346"><a href="#cb15-346" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-349"><a href="#cb15-349" aria-hidden="true" tabindex="-1"></a><span class="in">```{r}</span></span>
<span id="cb15-350"><a href="#cb15-350" aria-hidden="true" tabindex="-1"></a>df <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(), <span class="st">"/data/raw/"</span>,<span class="st">"01b_interventions_priordata_postcoding.csv"</span>)) <span class="sc">%&gt;%</span> </span>
<span id="cb15-351"><a href="#cb15-351" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(drop <span class="sc">==</span> <span class="dv">0</span>) <span class="sc">%&gt;%</span></span>
<span id="cb15-352"><a href="#cb15-352" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">select</span>(wikidata_name, wikidata_id) <span class="sc">%&gt;%</span></span>
<span id="cb15-353"><a href="#cb15-353" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">distinct</span>()</span>
<span id="cb15-354"><a href="#cb15-354" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-355"><a href="#cb15-355" aria-hidden="true" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(df)</span>
<span id="cb15-356"><a href="#cb15-356" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-357"><a href="#cb15-357" aria-hidden="true" tabindex="-1"></a><span class="fu">write.csv</span>(df, <span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(), <span class="st">"/data/raw/"</span>,<span class="st">"01c_interventions_priordata_unique.csv"</span>))</span>
<span id="cb15-358"><a href="#cb15-358" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb15-359"><a href="#cb15-359" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-360"><a href="#cb15-360" aria-hidden="true" tabindex="-1"></a>The dataframe is now set up so that coders can identify whether each wikidata entry qualified as a US military intervention as well as what unit of analysis that intervention describes. Coders can then fill in the rest of the unit of analysis columns to populate the full universe of cases.</span>
<span id="cb15-361"><a href="#cb15-361" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-362"><a href="#cb15-362" aria-hidden="true" tabindex="-1"></a><span class="fu"># Compare Existing Datasets to Wiki</span></span>
<span id="cb15-363"><a href="#cb15-363" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-364"><a href="#cb15-364" aria-hidden="true" tabindex="-1"></a>We want to identify the US military interventions in current political science datasets that are on wikipedia and what interventions are on wikipedia but not in current datasets.</span>
<span id="cb15-365"><a href="#cb15-365" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-368"><a href="#cb15-368" aria-hidden="true" tabindex="-1"></a><span class="in">```{r}</span></span>
<span id="cb15-369"><a href="#cb15-369" aria-hidden="true" tabindex="-1"></a><span class="co"># Loading interv list here</span></span>
<span id="cb15-370"><a href="#cb15-370" aria-hidden="true" tabindex="-1"></a>wiki <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(), <span class="st">"/data/raw/"</span>,<span class="st">"01d_interventions_newdata_list.csv"</span>))</span>
<span id="cb15-371"><a href="#cb15-371" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-372"><a href="#cb15-372" aria-hidden="true" tabindex="-1"></a><span class="co"># Load and prep 01b postcoding</span></span>
<span id="cb15-373"><a href="#cb15-373" aria-hidden="true" tabindex="-1"></a>prior <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(<span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(), <span class="st">"/data/raw/"</span>,<span class="st">"01b_interventions_priordata_postcoding.csv"</span>)) <span class="sc">%&gt;%</span> </span>
<span id="cb15-374"><a href="#cb15-374" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(drop <span class="sc">==</span> <span class="dv">0</span>) <span class="sc">%&gt;%</span></span>
<span id="cb15-375"><a href="#cb15-375" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">select</span>(dataset, wikidata_name, wikidata_id)</span>
<span id="cb15-376"><a href="#cb15-376" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-377"><a href="#cb15-377" aria-hidden="true" tabindex="-1"></a>prior<span class="sc">$</span>dataset <span class="ot">&lt;-</span> <span class="fu">as.factor</span>(prior<span class="sc">$</span>dataset)</span>
<span id="cb15-378"><a href="#cb15-378" aria-hidden="true" tabindex="-1"></a>prior <span class="ot">&lt;-</span> fastDummies<span class="sc">::</span><span class="fu">dummy_cols</span>(prior, <span class="at">select_columns =</span> <span class="st">"dataset"</span>)</span>
<span id="cb15-379"><a href="#cb15-379" aria-hidden="true" tabindex="-1"></a>prior<span class="sc">$</span>dataset <span class="ot">&lt;-</span> <span class="cn">NULL</span></span>
<span id="cb15-380"><a href="#cb15-380" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-381"><a href="#cb15-381" aria-hidden="true" tabindex="-1"></a>prior <span class="ot">&lt;-</span> prior <span class="sc">%&gt;%</span></span>
<span id="cb15-382"><a href="#cb15-382" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">distinct</span>()</span>
<span id="cb15-383"><a href="#cb15-383" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-384"><a href="#cb15-384" aria-hidden="true" tabindex="-1"></a><span class="co"># Merge common rows</span></span>
<span id="cb15-385"><a href="#cb15-385" aria-hidden="true" tabindex="-1"></a>prior_temp <span class="ot">&lt;-</span> prior <span class="sc">%&gt;%</span></span>
<span id="cb15-386"><a href="#cb15-386" aria-hidden="true" tabindex="-1"></a>  tidyr<span class="sc">::</span><span class="fu">pivot_longer</span>(<span class="at">cols =</span> dplyr<span class="sc">::</span><span class="fu">starts_with</span>(<span class="st">"dataset_"</span>),</span>
<span id="cb15-387"><a href="#cb15-387" aria-hidden="true" tabindex="-1"></a>                      <span class="at">names_to =</span> <span class="st">"dataset"</span>,</span>
<span id="cb15-388"><a href="#cb15-388" aria-hidden="true" tabindex="-1"></a>                      <span class="at">values_to =</span> <span class="st">"contains"</span>) <span class="sc">%&gt;%</span></span>
<span id="cb15-389"><a href="#cb15-389" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(contains <span class="sc">==</span> <span class="dv">1</span>) <span class="sc">%&gt;%</span></span>
<span id="cb15-390"><a href="#cb15-390" aria-hidden="true" tabindex="-1"></a>  tidyr<span class="sc">::</span><span class="fu">pivot_wider</span>(<span class="at">id_cols =</span> dplyr<span class="sc">::</span><span class="fu">starts_with</span>(<span class="st">"wikidata_"</span>),</span>
<span id="cb15-391"><a href="#cb15-391" aria-hidden="true" tabindex="-1"></a>                     <span class="at">names_from =</span> <span class="st">"dataset"</span>,</span>
<span id="cb15-392"><a href="#cb15-392" aria-hidden="true" tabindex="-1"></a>                     <span class="at">values_from =</span> <span class="st">"contains"</span>) <span class="sc">%&gt;%</span></span>
<span id="cb15-393"><a href="#cb15-393" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate_if</span>(is.numeric, <span class="sc">~</span>tidyr<span class="sc">::</span><span class="fu">replace_na</span>(., <span class="dv">0</span>))</span>
<span id="cb15-394"><a href="#cb15-394" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-395"><a href="#cb15-395" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(plyr)</span>
<span id="cb15-396"><a href="#cb15-396" aria-hidden="true" tabindex="-1"></a>prior_temp <span class="ot">&lt;-</span> plyr<span class="sc">::</span><span class="fu">ddply</span>(prior_temp, .(wikidata_id), summarize,</span>
<span id="cb15-397"><a href="#cb15-397" aria-hidden="true" tabindex="-1"></a>                          <span class="at">wikidata_name =</span> <span class="fu">paste</span>(wikidata_name, <span class="at">collapse =</span> <span class="st">","</span>),</span>
<span id="cb15-398"><a href="#cb15-398" aria-hidden="true" tabindex="-1"></a>                          <span class="at">dataset_icb =</span> <span class="fu">paste</span>(dataset_icb, <span class="at">collapse =</span> <span class="st">","</span>),</span>
<span id="cb15-399"><a href="#cb15-399" aria-hidden="true" tabindex="-1"></a>                          <span class="at">dataset_imi =</span> <span class="fu">paste</span>(dataset_imi, <span class="at">collapse =</span> <span class="st">","</span>),</span>
<span id="cb15-400"><a href="#cb15-400" aria-hidden="true" tabindex="-1"></a>                          <span class="at">dataset_mids =</span> <span class="fu">paste</span>(dataset_mids, <span class="at">collapse =</span> <span class="st">","</span>),</span>
<span id="cb15-401"><a href="#cb15-401" aria-hidden="true" tabindex="-1"></a>                          <span class="at">dataset_mip =</span> <span class="fu">paste</span>(dataset_mip, <span class="at">collapse =</span> <span class="st">","</span>),</span>
<span id="cb15-402"><a href="#cb15-402" aria-hidden="true" tabindex="-1"></a>                          <span class="at">dataset_mips =</span> <span class="fu">paste</span>(dataset_mips, <span class="at">collapse =</span> <span class="st">","</span>),</span>
<span id="cb15-403"><a href="#cb15-403" aria-hidden="true" tabindex="-1"></a>                          <span class="at">dataset_prio =</span> <span class="fu">paste</span>(dataset_prio, <span class="at">collapse =</span> <span class="st">","</span>),</span>
<span id="cb15-404"><a href="#cb15-404" aria-hidden="true" tabindex="-1"></a>                          <span class="at">dataset_rand =</span> <span class="fu">paste</span>(dataset_rand, <span class="at">collapse =</span> <span class="st">","</span>))</span>
<span id="cb15-405"><a href="#cb15-405" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-406"><a href="#cb15-406" aria-hidden="true" tabindex="-1"></a>prior_temp <span class="ot">&lt;-</span> prior_temp <span class="sc">%&gt;%</span></span>
<span id="cb15-407"><a href="#cb15-407" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">select</span>(<span class="sc">-</span>wikidata_name)</span>
<span id="cb15-408"><a href="#cb15-408" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-409"><a href="#cb15-409" aria-hidden="true" tabindex="-1"></a><span class="do">## Format air power dataset</span></span>
<span id="cb15-410"><a href="#cb15-410" aria-hidden="true" tabindex="-1"></a>aerial_sub <span class="ot">&lt;-</span> aerial_prior[, <span class="fu">c</span>(<span class="st">"war_wikidata_name"</span>, <span class="st">"allen"</span>, <span class="st">"horowitz"</span>)] <span class="sc">%&gt;%</span></span>
<span id="cb15-411"><a href="#cb15-411" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="at">wikidata_name =</span> war_wikidata_name)</span>
<span id="cb15-412"><a href="#cb15-412" aria-hidden="true" tabindex="-1"></a>wide <span class="ot">&lt;-</span> aerial_sub</span>
<span id="cb15-413"><a href="#cb15-413" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-414"><a href="#cb15-414" aria-hidden="true" tabindex="-1"></a><span class="co">#fix coding error</span></span>
<span id="cb15-415"><a href="#cb15-415" aria-hidden="true" tabindex="-1"></a>wide<span class="sc">$</span>wikidata_name <span class="ot">&lt;-</span> <span class="fu">gsub</span>(<span class="st">"Iraqi Kurdish civil war"</span>, <span class="st">"Iraqi Kurdish Civil War"</span>, wide<span class="sc">$</span>wikidata_name)</span>
<span id="cb15-416"><a href="#cb15-416" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-417"><a href="#cb15-417" aria-hidden="true" tabindex="-1"></a>wide_fin <span class="ot">&lt;-</span> wide <span class="sc">%&gt;%</span>  </span>
<span id="cb15-418"><a href="#cb15-418" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="at">dataset_allen =</span> allen,</span>
<span id="cb15-419"><a href="#cb15-419" aria-hidden="true" tabindex="-1"></a>                <span class="at">dataset_horowitz =</span> horowitz)</span>
<span id="cb15-420"><a href="#cb15-420" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-421"><a href="#cb15-421" aria-hidden="true" tabindex="-1"></a>wide_fin<span class="sc">$</span>dataset_allen <span class="ot">&lt;-</span> <span class="fu">as.character</span>(wide_fin<span class="sc">$</span>dataset_allen)</span>
<span id="cb15-422"><a href="#cb15-422" aria-hidden="true" tabindex="-1"></a>wide_fin<span class="sc">$</span>dataset_horowitz <span class="ot">&lt;-</span> <span class="fu">as.character</span>(wide_fin<span class="sc">$</span>dataset_horowitz)</span>
<span id="cb15-423"><a href="#cb15-423" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-424"><a href="#cb15-424" aria-hidden="true" tabindex="-1"></a><span class="co"># Merge the new dummy encodings into the original list of all mil op interv on wiki</span></span>
<span id="cb15-425"><a href="#cb15-425" aria-hidden="true" tabindex="-1"></a>df <span class="ot">&lt;-</span> wiki</span>
<span id="cb15-426"><a href="#cb15-426" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-427"><a href="#cb15-427" aria-hidden="true" tabindex="-1"></a>df <span class="ot">&lt;-</span> dplyr<span class="sc">::</span><span class="fu">left_join</span>(df, prior_temp, <span class="at">by =</span> <span class="st">"wikidata_id"</span>)</span>
<span id="cb15-428"><a href="#cb15-428" aria-hidden="true" tabindex="-1"></a>df <span class="ot">&lt;-</span> dplyr<span class="sc">::</span><span class="fu">full_join</span>(df, wide_fin, <span class="at">by =</span> <span class="st">"wikidata_name"</span>)</span>
<span id="cb15-429"><a href="#cb15-429" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-430"><a href="#cb15-430" aria-hidden="true" tabindex="-1"></a><span class="co"># Visualize comparison</span></span>
<span id="cb15-431"><a href="#cb15-431" aria-hidden="true" tabindex="-1"></a>df <span class="ot">&lt;-</span> df <span class="sc">%&gt;%</span></span>
<span id="cb15-432"><a href="#cb15-432" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">filter</span>(<span class="sc">!</span><span class="fu">is.na</span>(wikidata_id)) <span class="sc">%&gt;%</span></span>
<span id="cb15-433"><a href="#cb15-433" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">select</span>(wikidata_name, wikidata_id, dplyr<span class="sc">::</span><span class="fu">starts_with</span>(<span class="st">"dataset_"</span>)) <span class="sc">%&gt;%</span></span>
<span id="cb15-434"><a href="#cb15-434" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">distinct</span>() <span class="sc">%&gt;%</span></span>
<span id="cb15-435"><a href="#cb15-435" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">rename_at</span>(<span class="fu">vars</span>(dplyr<span class="sc">::</span><span class="fu">starts_with</span>(<span class="st">"dataset_"</span>)),</span>
<span id="cb15-436"><a href="#cb15-436" aria-hidden="true" tabindex="-1"></a>                   dplyr<span class="sc">::</span><span class="fu">funs</span>(stringr<span class="sc">::</span><span class="fu">str_replace</span>(., <span class="st">"dataset_"</span>, <span class="st">""</span>))) <span class="sc">%&gt;%</span></span>
<span id="cb15-437"><a href="#cb15-437" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="st">'MONSTr'</span> <span class="ot">=</span> <span class="dv">1</span>) <span class="sc">%&gt;%</span></span>
<span id="cb15-438"><a href="#cb15-438" aria-hidden="true" tabindex="-1"></a>  <span class="fu">replace</span>(<span class="fu">is.na</span>(.), <span class="st">"0"</span>)</span>
<span id="cb15-439"><a href="#cb15-439" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-440"><a href="#cb15-440" aria-hidden="true" tabindex="-1"></a>df <span class="sc">%&gt;%</span></span>
<span id="cb15-441"><a href="#cb15-441" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">select</span>(<span class="sc">-</span>wikidata_name, <span class="sc">-</span>wikidata_id) <span class="sc">%&gt;%</span></span>
<span id="cb15-442"><a href="#cb15-442" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate_if</span>(is.character, as.numeric) <span class="sc">%&gt;%</span></span>
<span id="cb15-443"><a href="#cb15-443" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="at">Allen =</span> allen,</span>
<span id="cb15-444"><a href="#cb15-444" aria-hidden="true" tabindex="-1"></a>                <span class="at">Horowitz =</span> horowitz,</span>
<span id="cb15-445"><a href="#cb15-445" aria-hidden="true" tabindex="-1"></a>                <span class="at">ICB =</span> icb,</span>
<span id="cb15-446"><a href="#cb15-446" aria-hidden="true" tabindex="-1"></a>                <span class="at">MIPS =</span> mips,</span>
<span id="cb15-447"><a href="#cb15-447" aria-hidden="true" tabindex="-1"></a>                <span class="at">IMI =</span> imi,</span>
<span id="cb15-448"><a href="#cb15-448" aria-hidden="true" tabindex="-1"></a>                <span class="at">MID =</span> mids,</span>
<span id="cb15-449"><a href="#cb15-449" aria-hidden="true" tabindex="-1"></a>                <span class="at">MIP =</span> mip,</span>
<span id="cb15-450"><a href="#cb15-450" aria-hidden="true" tabindex="-1"></a>                <span class="at">RAND =</span> rand) <span class="sc">%&gt;%</span></span>
<span id="cb15-451"><a href="#cb15-451" aria-hidden="true" tabindex="-1"></a>  UpSetR<span class="sc">::</span><span class="fu">upset</span>(<span class="at">nsets =</span> <span class="dv">9</span>,</span>
<span id="cb15-452"><a href="#cb15-452" aria-hidden="true" tabindex="-1"></a>      <span class="at">number.angles =</span> <span class="dv">0</span>,</span>
<span id="cb15-453"><a href="#cb15-453" aria-hidden="true" tabindex="-1"></a>      <span class="at">point.size =</span> <span class="fl">2.5</span>,</span>
<span id="cb15-454"><a href="#cb15-454" aria-hidden="true" tabindex="-1"></a>      <span class="at">line.size =</span> <span class="dv">1</span>,</span>
<span id="cb15-455"><a href="#cb15-455" aria-hidden="true" tabindex="-1"></a>      <span class="at">text.scale =</span> <span class="fl">1.8</span>,</span>
<span id="cb15-456"><a href="#cb15-456" aria-hidden="true" tabindex="-1"></a>      <span class="at">mainbar.y.label =</span> <span class="st">"Number of Interventions"</span>,</span>
<span id="cb15-457"><a href="#cb15-457" aria-hidden="true" tabindex="-1"></a>      <span class="at">sets.x.label =</span> <span class="st">"Observations"</span>,</span>
<span id="cb15-458"><a href="#cb15-458" aria-hidden="true" tabindex="-1"></a>      <span class="at">set_size.numbers_size =</span> <span class="fl">1.2</span>,</span>
<span id="cb15-459"><a href="#cb15-459" aria-hidden="true" tabindex="-1"></a>      <span class="at">order.by =</span> <span class="st">"freq"</span>)</span>
<span id="cb15-460"><a href="#cb15-460" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb15-461"><a href="#cb15-461" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-462"><a href="#cb15-462" aria-hidden="true" tabindex="-1"></a>Save .csv that is list of all interventions on wiki and their coverage in existing datasets</span>
<span id="cb15-463"><a href="#cb15-463" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-466"><a href="#cb15-466" aria-hidden="true" tabindex="-1"></a><span class="in">```{r}</span></span>
<span id="cb15-467"><a href="#cb15-467" aria-hidden="true" tabindex="-1"></a><span class="fu">write.csv</span>(df, <span class="fu">paste0</span>(here<span class="sc">::</span><span class="fu">here</span>(), <span class="st">"/data/"</span>,<span class="st">"01_interventions_newdata_comparison.csv"</span>))</span>
<span id="cb15-468"><a href="#cb15-468" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
</code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div></div></div></div></div>
</div> <!-- /content -->



</body></html>